Allowing application to finish before shutdown completes


Here is the scenario...

I have an application that runs in the tray that needs to updates a data file as it unloads.  Since this application runs on startup, it also needs to be able to finish it's "cleanup" before the machine actually finsihes a controlled shutdown.

Is there a clean way to do this?

-M
LVL 6
MELeBlancAsked:
Who is Participating?
 
Dave_GreeneConnect With a Mentor Commented:
Something like this... check the unloadmode

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  If UnloadMode = vbAppWindows Then
     'finish processing here
  End If
End Sub
0
 
MELeBlancAuthor Commented:
That will pause the shutdown process long enough to let my program complete?

-M
0
 
Dave_GreeneCommented:
yes, it will not terminate until the processing is complete.
0
 
MELeBlancAuthor Commented:
Works like a charm... thankee sir!

-M
0
 
Dave_GreeneCommented:
Welcomeee  :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.