mvh Johnny Fladstrand --------------------------------------- Option Explicit
DefInt A-Z
Declare Function Shell_NotifyIconA Lib \"SHELL32\" (ByVal dwMessage As Long, _ lpData As NOTIFYICONDATA) As Long
Type NOTIFYICONDATA cbSize As Long hwnd As Long uID As Long uFlags As Long uCallbackMessage As Long hIcon As Long szTip As String * 64 End Type
Global Const NIM_ADD = &H0& \'constants & flags for NotifyIcons Global Const NIM_MODIFY = &H1 Global Const NIM_DELETE = &H2 Global Const NIF_MESSAGE = &H1 Global Const NIF_ICON = &H2 Global Const NIF_TIP = &H4 Global Const WM_MOUSEMOVE = &H200 Global NI As NOTIFYICONDATA
Public Sub RemoveTrayIcon() Dim result As Long
result = Shell_NotifyIconA(NIM_DELETE, NI) \'removes the icon from the tray End Sub
Public Sub ChangeTrayIconToolTip(strToolTip As String) Dim result As Long
NI.szTip = strToolTip + Chr$(0) result = Shell_NotifyIconA(NIM_MODIFY, NI) End Sub
Public Sub CreateTrayIcon(strToolTip As String) Dim result As Long NI.cbSize = Len(NI) \'set the length of this structure NI.hwnd = frmTrayIcon.TrayIcon.hwnd \'control to receive messages from NI.uID = 0 \'uniqueID NI.uID = NI.uID + 1 NI.uFlags = NIF_MESSAGE Or NIF_ICON Or NIF_TIP \'operation flags NI.uCallbackMessage = WM_MOUSEMOVE \'recieve messages from mouse activities NI.hIcon = frmTrayIcon.TrayIcon.Picture \'the location of the icon to display NI.szTip = strToolTip + Chr$(0) \'the tool tip to display result = Shell_NotifyIconA(NIM_ADD, NI) \'add the icon to the system tray End Sub ---------------------------------------
Hvis du setter alt koden ind som Form1 kode så skal det se sådan ud.
Private Declare Function Shell_NotifyIconA Lib \"SHELL32\" (ByVal dwMessage As Long, _ lpData As NOTIFYICONDATA) As Long
Private Type NOTIFYICONDATA cbSize As Long hwnd As Long uID As Long uFlags As Long uCallbackMessage As Long hIcon As Long szTip As String * 64 End Type
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.