PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Ivan Iraola on November 02, 2009, 10:07:45 PM

Title: Ending program (Close_Form) - issues
Post by: Ivan Iraola on November 02, 2009, 10:07:45 PM
I've noticed that if you have a loop (For...Next, While...Wend) running and FF_DoEvents inside the loop, if you close the form(s) the program continues running in the background until the loop ends  :o , I added the FF_CloseForm(HWND_FORM1) to the "Exit" button and also to the FORM1_WM_DESTROY, same thing, the program lingers in memory and the only way to kill it is via Task Manager.

Also, if you have a multi-form application and you close the program (via a Button or by clicking on the X on the SysMenu) and the "extra" forms VISIBLE, the program crashes (see attached picture)

It seems to me that the FF_CloseForm function has issues because sometimes even on a single form, no loops application, the program doesn't finish, the form goes away giving you the impression that it ended, but if you look in Task Manager, is still there.
Title: Re: Ending program (Close_Form) - issues
Post by: Paul Squires on November 02, 2009, 10:40:13 PM
I am not sure why you are running a loop and exiting the program without first ensuring that your loop is exited? Is this some type of simulate THREAD approach that you are using?

You should ensure that the loop is exited prior to ending the program. This would be the case whether it is a FireFly program or a regular Windows/API/DDT program.

Create a global variable, say, gExitProgram, and set it to %TRUE in the WM_DESTROY of your main form (FORM1?). In your loop, check the value of gExitProgram on each iteration of the loop and do an EXIT LOOP if gExitProgram = %TRUE.

Hopefully that will work for you.  :)