Results 1 to 10 of 10

Thread: How to detect windows Shutdown???

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2001
    Location
    New Delhi
    Posts
    34

    Cool How to detect windows Shutdown???

    Hey guys,
    see if u can help me on this one?
    i want to detect windows shutdown.....is there any API to do this?
    the thing is i want my application to write to a log file everytime the windows shutsdown......

    all help is greatly appiciated........

    Thanx
    Amprat

    Msg for Gibbo : dude i am still working on that IE Problem ....will let u know what i find out!!! cheers
    **** Happens!

  2. #2
    Matthew Gates
    Guest
    No need for API.


    VB Code:
    1. Private Sub Form_QueryUnload (Cancel As Integer, UnloadMode As Integer)
    2.    If UnloadMode = 2 Then
    3.        Msgbox "Windows is shutting down"
    4.    End If
    5. End Sub

  3. #3
    New Member
    Join Date
    Oct 2001
    Location
    Indore
    Posts
    9

    Arrow

    hi

    u can do this from sysinfo object

  4. #4
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    no no no, that code is placed in the unload event of a form. When Windows shutsdown, it attempts to close everything, including your forms. If you have that code, it will display the message box when you shutdown windows.

  5. #5

    Thread Starter
    Member
    Join Date
    Sep 2001
    Location
    New Delhi
    Posts
    34
    i tried to put the Form_queryunload code as suggested by mathew gates but it does not work....i donno why but the unloadmode never becomes 2???
    please help with ode ...if possible!

    Regards
    Amprat
    **** Happens!

  6. #6
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    not sure this is going to help, but try changing 2 to vbAppWindows

  7. #7
    PowerPoster
    Join Date
    Aug 2000
    Location
    India
    Posts
    2,288
    You might not get the response in case of Forced Shutdown.

  8. #8

    Thread Starter
    Member
    Join Date
    Sep 2001
    Location
    New Delhi
    Posts
    34
    So what's the solution to detect shutdown?????

    Please Suggest!

    Regards

    Amprat
    **** Happens!

  9. #9
    PowerPoster
    Join Date
    Aug 2000
    Location
    India
    Posts
    2,288
    Subclass your main form and look for the WM_QUERYENDSESSION
    message. This is what the systems sends while shutting down the system

  10. #10
    Matthew Gates
    Guest
    Originally posted by amitabh
    You might not get the response in case of Forced Shutdown.

    Most of the time, I believe you will get the Msgbox, but even if OK is there, it will close the Msgbox automatically.

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