Results 1 to 5 of 5

Thread: Detect Shutdown and logoff operations

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2004
    Posts
    4

    Detect Shutdown and logoff operations

    Hai,

    I've to detect when the system is shutdown or logged off using VB. Could anyone help me out with the code for this. or suggest some APIs used

    Thank you,

    Regards,
    K. Sripriya

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    I suppose you could just have a form open and use the QueryUnload event.
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  3. #3
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    Here's what crptcblade means

    VB Code:
    1. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    2.  
    3.     Select Case UnloadMode
    4.         Case vbFormControlMenu
    5.             MsgBox "The user chose the Close command (the ""X"") from the Control menu on the form."
    6.         Case vbFormCode
    7.             MsgBox "The Unload statement is invoked from code."
    8.         Case vbAppWindows
    9.             MsgBox "The current Microsoft Windows operating environment session is ending."
    10.         Case vbAppTaskManager
    11.             MsgBox "The Microsoft Windows Task Manager is closing the application."
    12.         Case vbFormMDIForm
    13.             MsgBox "An MDI child form is closing because the MDI form is closing."
    14.         Case vbFormOwner
    15.             MsgBox "A form is closing because its owner is closing."
    16.     End Select
    17.  
    18. End Sub

  4. #4
    Frenzied Member
    Join Date
    May 2003
    Location
    So Cal
    Posts
    1,564
    Does he mean "system" as a Computer or an Application?

  5. #5
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171
    You can also subclass a form but I don't remember the messages you are supposed to look for...


    Has someone helped you? Then you can Rate their helpful post.

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