To stay the application in system tray


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: To stay the application in system tray

  1. #1
    Join Date
    Sep 2006
    Location
    Iraq
    Posts
    13

    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...
    Last edited by ahsal; 01-07-2007 at 04:42 PM. Reason: Spelling fault

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    Try this:
    Code:
    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
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  3. #3
    Join Date
    Sep 2006
    Location
    Iraq
    Posts
    13
    Thank you very much Mr. Phil

    that is the result i hoped for that.

Similar Threads

  1. Replies: 1
    Last Post: 12-01-2002, 06:42 AM
  2. Inventory Management Application Using VB
    By Krishna in forum vb.announcements
    Replies: 0
    Last Post: 11-25-2002, 11:03 PM
  3. System tray in vb
    By andy in forum VB Classic
    Replies: 0
    Last Post: 02-26-2002, 05:07 PM
  4. System Tray Without Form
    By Björn Olofsson in forum VB Classic
    Replies: 2
    Last Post: 01-22-2001, 10:09 AM
  5. System Tray
    By Eli Martin in forum VB Classic
    Replies: 0
    Last Post: 01-18-2001, 01:24 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center