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
Private Declare Function Shell_NotifyIcon Lib "shell32.dll" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, lpData As NOTIFYICONDATA) As Long
Private Sub Form_Load() With tTrayIcon .hIcon = Icon .hwnd = Picture1.hwnd .szTip = Caption & Chr(0) .uCallbackMessage = WM_MOUSEMOVE .uFlags = NIF_ICON Or NIF_MESSAGE Or NIF_TIP .uID = 1 .cbSize = Len(tTrayIcon) End With Shell_NotifyIcon NIM_ADD, tTrayIcon End Sub
Private Sub Form_Resize() If WindowState = vbMinimized Then Hide WindowState = vbNormal End If End Sub
Private Sub Form_Unload(Cancel As Integer) Shell_NotifyIcon NIM_DELETE, tTrayIcon End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Select Case ScaleX(X, vbTwips, vbPixels) Case WM_RBUTTONUP 'Used for Displaying a Popup Menu Case WM_LBUTTONDBLCLK 'Double Click on SysTray Icon to Show Form Show End Select End Sub
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.