Results 1 to 4 of 4

Thread: Using X (close) button to send to tray

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2001
    Posts
    414

    Using X (close) button to send to tray

    How do you get a handle on the X button in the title bar to send to tray instead of closing? I have the code to send to tray but no matter what I try the X still ends the program. Is this an API?

  2. #2
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    No simply use the Form_QueryUnload event.
    VB Code:
    1. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    2.     If UnloadMode = vbFormControlMenu Then
    3.         Cancel = True 'stop the unloading of the form
    4.         Me.Hide 'hide the form
    5.         '...
    6.         'code to set an icon in the System Tray
    7.     End If
    8. End Sub
    Best regards

  3. #3
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

    Well

    If UnloadMode = vbFormControlMenu Then

    Cancel = True

    Me.windowstate = vbminimized

    end if
    Remaining quiet down here !!!

    BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    May 2001
    Posts
    414
    Thank you...that makes perfect sense

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