Results 1 to 4 of 4

Thread: can my app know that windows is shutting down?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Posts
    149

    can my app know that windows is shutting down?

    My application has an "Are you sure...?" prompt in "Form_QueryUnload".

    The trouble with this is if windows is shutting down, this prompt gets in the way.

    Can I detect that windows is shutting down so that I can remove this prompt from the procedure?
    This must work on both win2k and win98.
    Thanks,
    John

  2. #2
    Hyperactive Member brenaaro's Avatar
    Join Date
    Sep 2001
    Location
    Montreal, Canada
    Posts
    391
    Check if UnloadMode = vbAppWindows
    And I, for one, welcome our new insect overlords. I'd like to remind them as a trusted TV personality, I can be helpful in rounding up others to toil in their underground sugar caves.

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Use The One brenaaro suggested for this instance...

    but, for future reference, here are all the unloadmodes available.
    VB Code:
    1. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    2. 'there are 5 unloadmode levels
    3.         Select Case UnloadMode
    4.             Case vbFormControlMenu 'UnloadMode 0
    5.                  'form is being unloaded via the Close
    6.                  'or by hitting the X in the upper right hand corner
    7.                  'command from the System menu
    8.             Case vbFormCode        'UnloadMode 1
    9.                  'Unload Me has been issued from code
    10.             Case vbAppWindows      'UnloadMode 2
    11.                  'Windows itself is closing
    12.             Case vbAppTaskManager  'UnloadMode 3
    13.                  'the Task Manager is closing the app
    14.             Case vbFormMDIForm     'UnloadMod 4
    15.                  'an MDI child form is closing because
    16.                  'its parent form is closing
    17.         End Select
    18. End Sub

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Posts
    149
    Check if UnloadMode = vbAppWindows
    that did it.
    Thanks!

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