dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: QueryUnload when quitting Windows

  1. #1
    Join Date
    Oct 2003
    Location
    The Dutch Mountains
    Posts
    125

    QueryUnload when quitting Windows

    Hey you guys,

    I made a program thats running in the systemtray.
    After dubble clicking, the form appears on the screen. When I click on the cross in the right upper corner, I don't want to close the program but hide again in the system tray so I used this:

    Private Sub Form_QueryUnload(Cancel as integer, UnloadMode as integer)
    Cancel=1
    Prog_Hide (subroutine to hide in systemtray)
    End Sub

    It works great, but If I want to shutdown windows, It dont closes my application so Windows will not shutdown.

    Can some one help me out with this?

    Thanx
    Give up your guns and face the law!!

  2. #2
    Join Date
    Mar 2003
    Location
    India {Mumbai};
    Posts
    3,871

    Re: QueryUnload when quitting Windows

    Check UnloadMode against vbAppWindows, which means Windows is shutting down.
    Code:
    ...
    IF UnloadMode = vbAppWindows then
    ' Dont Cancel
    See QueryUnload Event in MSDN.
    My latest article: Explicating the new C++ standard (C++0x)

    Do rate the posts you find useful.

  3. #3
    Join Date
    Oct 2003
    Location
    The Dutch Mountains
    Posts
    125

    Re: QueryUnload when quitting Windows

    It works.
    Thanks for your quick reply

    See ya later
    Give up your guns and face the law!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)