?Recognize WindowsNT-Shutdonw via API? (under NT)

I want to recognize the windows shutdown with VB4.0. The Form_Unload does not work because
my programm has a loop in the Form_Load! So I need to recognize the windows-shutdown from somewhere else.
API?
OR: if you know how to palce my loop out of the Form_Load so that it is also startet immediately when running.

swilt wrote:" loop in the Form_Activate and look at UnloadMode in the Form_QueryUnload"
HOW??? Explain???
loleAsked:
Who is Participating?
 
watyConnect With a Mentor Commented:
The only thing to do is adding a DoEvents in your loop in Form_Load

Sub Form_Load
  Do while True
     ...
     DoEvents
     ...
  Loop
End Sub

Sub Form_UnLoad
  ' *** Quit
End Sub

0
 
swiltCommented:
loop in the Form_Activate and look at UnloadMode in the Form_QueryUnload
0
 
loleAuthor Commented:
Edited text of question
0
 
loleAuthor Commented:
Swilt, pleas give na example that works
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.