Hi,
How do I make a loop end when windows 98 se shuts down or restarts???
Please help.
Thanks,
Kevin
Printable View
Hi,
How do I make a loop end when windows 98 se shuts down or restarts???
Please help.
Thanks,
Kevin
I don't seem to get what you mean but,
isn't it that programs are automatically
ended (and thus the loop ends also) when
the Windows is shutdown/restarted?
That is whatn I thought also. However, when I have this program runing, which is a module running in the background, when I shut down or restart windows it will not close. Windows says it will not respond. Someonne told me I have to subclass to make it close, but I don't know how to do that.
Kevin
IF you have anything like this:
DO
.
.
doevents
.
.
Loop
There is always a possibility that your program wont close manually, especially if it takes a long time. And if it never ends, this makes your program unloadable
I use to solve this problem by not doing any continous loop that never ends. But there is a way, it's a little complicated but it should work.
'CODE-------------------------------
'Declaration----------------------
Dim unloadnow As Byte
'The loop-------------------------
Private Sub Command1_Click()
Do
DoEvents
Loop Until unloadnow
unloadnow = 1
Unload Me
End Sub
'The unload section---------------
Private Sub Form_Unload(Cancel As Integer)
If unloadnow < 2 Then
unloadnow = 1
Cancel = 1
End If
End
End Sub
'------------------------------------
Thanks,
However, I have no forms in my program just a module, what is the unload sub called for a module???
Thanks,
Kevin