|
-
Mar 19th, 2000, 11:49 AM
#1
Thread Starter
Member
Hi,
How do I make a loop end when windows 98 se shuts down or restarts???
Please help.
Thanks,
Kevin
-
Mar 19th, 2000, 12:48 PM
#2
Lively Member
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?
-
Mar 19th, 2000, 01:09 PM
#3
Thread Starter
Member
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
-
Mar 19th, 2000, 05:28 PM
#4
transcendental analytic
I have the cure
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
'------------------------------------
-
Mar 19th, 2000, 11:40 PM
#5
Thread Starter
Member
Thanks,
However, I have no forms in my program just a module, what is the unload sub called for a module???
Thanks,
Kevin
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|