Results 1 to 5 of 5

Thread: Making a loop end hen windows shuts down

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2000
    Location
    Seattle, WA, USA
    Posts
    46
    Hi,


    How do I make a loop end when windows 98 se shuts down or restarts???

    Please help.

    Thanks,

    Kevin

  2. #2
    Lively Member
    Join Date
    Jun 1999
    Posts
    120
    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?


  3. #3

    Thread Starter
    Member
    Join Date
    Feb 2000
    Location
    Seattle, WA, USA
    Posts
    46
    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

  4. #4
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221

    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
    '------------------------------------

  5. #5

    Thread Starter
    Member
    Join Date
    Feb 2000
    Location
    Seattle, WA, USA
    Posts
    46
    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
  •  



Click Here to Expand Forum to Full Width