I feel silly asking this...

Started by BudDurland, January 29, 2008, 01:16:11 PM

Previous topic - Next topic

BudDurland

On an application that I wrote here at work, I added a timer to the main (only) form.  Basically, the timer checks for user activity based on a global flag.  When no activity happens for 2 passes of the timer (about 20 minutes), I do an FF_CLOSEFORM.  Since there is only one form, I expected this would close the program.  I've seen a couple of instances where the form was closed, but the executable stayed in memory.  This program generates reports.  Clicking the button to make a report resets the activity flag, and none of the reports take longer than 60 seconds or so to make.  Is there a better approach to ending the program via code?

TechSupport

Not sure why the exe would stay in memory because the logic that you're using seems okay to me.

Just thinking out loud.... maybe closing the Form from within the Timer event is causing a problem? If that is a cause then maybe you can PostMessage a user defined message to the Main Form and then respond to that message in the CUSTOM message handler of the main form by issuing an FF_CloseForm. It's worth a try. :)




Mark Strickland

I remember a problem with a form and a timer that was closing the form.   I have not looked up the details yet but I had to do an API call to kill the timer in the form destroy.

Might be worth exploring.