Results 1 to 4 of 4

Thread: Closing my program on shut down.

  1. #1

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

    Closing my program on shut down

    Hi,

    My program will not close when windows 98 se shuts down or restarts. It is a module, no forms running in the background. Every time I shut down or restart windows, it tells me it is not responding, and I have to close it. How do I make it close automatically? I have heard I have to subclass to get this done, but how??


    Thanks,

    Kevin

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    That have occured to me a lot. You just have to find the loop that is not terminated by ending the program. IE:
    '-----------------code
    Sub blablabla
    .
    Do
    Doevents
    .
    .
    Loop
    .
    end sub


  3. #3

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

    I would really like my loop to end when my computer is shut down or restarted. How do I do this??

    Thanks,

    Kevin

  4. #4
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    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
    '------------------------------------

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