To stay the application in system tray
i have a problem in which i want to stay my program in the system tray even if i close the program by the close icon in the window.
for example when you click on close while running Yahoo Messenger, the messenger will not close permanently it stay in the system tray.
please help me in my problem because i want the program stays in the system tray even if i close it by clicking on the close icon of the window
Thank you...
[451 byte] By [
ahsal] at [2007-11-11 10:08:18]

# 1 Re: To stay the application in system tray
Try this:
Private Sub Form1_Closing(ByVal sender As Object, _
ByVal e As System.ComponentModel.CancelEventArgs) _
Handles MyBase.Closing
Dim stack As System.Diagnostics.StackTrace = _
New System.Diagnostics.StackTrace(True)
Dim frame As System.Diagnostics.StackFrame
frame = stack.GetFrame(7)
' User clicked form's Close icon
If frame.GetMethod.Name.ToString = "CallWindowProc" Then
Me.Hide
e.Cancel = True
End If
End Sub
# 2 Re: To stay the application in system tray
Thank you very much Mr. Phil
that is the result i hoped for that.
ahsal at 2007-11-11 20:49:28 >
