home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form Form1
- Caption = "Form1"
- ClientHeight = 2655
- ClientLeft = 1050
- ClientTop = 2445
- ClientWidth = 4575
- Icon = "ProDemo1.frx":0000
- LinkTopic = "Form1"
- ScaleHeight = 2655
- ScaleWidth = 4575
- Attribute VB_Name = "Form1"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- Const TrayIconID = 9999 ' ID of our Tray Icon
- ' Procedure to initialize common fields of the NotifyIconData structure
- Private Sub InitNID(nid As NotifyIconData, ByVal TipString As String)
- nid.cbSize = Len(nid)
- nid.hWnd = Form1.hWnd
- nid.uID = TrayIconID
- nid.uFlags = Nif_Message + Nif_Icon + Nif_Tip
- nid.uCallbackMessage = TrayCallback
- nid.hIcon = Form1.Icon.Handle
- nid.szTip = TipString + Chr(0)
- End Sub
- Private Sub Form_Load()
- Dim nid As NotifyIconData
- InitNID nid, "My First Tray Icon" ' Initialize the nid
- Shell_NotifyIcon Nim_Add, nid ' Add icon to the Tray
- ' Now subclass the form so that we receive Tray notifications
- OldWndProc = GetWindowLong(hWnd, Gwl_WndProc)
- SetWindowLong hWnd, Gwl_WndProc, AddressOf FormWindowProc
- End Sub
- Private Sub Form_Unload(Cancel As Integer)
- Dim nid As NotifyIconData
- InitNID nid, "" ' Initialize the nid
- Shell_NotifyIcon Nim_Delete, nid ' Remove icon from the Tray
- ' Unhook the subclassing mechanism from this form
- SetWindowLong hWnd, Gwl_WndProc, OldWndProc
- End Sub
-