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?
Printable View
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?
No simply use the Form_QueryUnload event.Best regardsVB Code:
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) If UnloadMode = vbFormControlMenu Then Cancel = True 'stop the unloading of the form Me.Hide 'hide the form '... 'code to set an icon in the System Tray End If End Sub
If UnloadMode = vbFormControlMenu Then
Cancel = True
Me.windowstate = vbminimized
end if
Thank you...that makes perfect sense