I have a security/information relay app that sends itself to the system tray just fine, letting me know that it's working correctly. However, at the time being, it just sits there and has the MouseOver ToolTip, but I can't call any sort of menu, and I'd like to. Any pointers how to do this?
I'm using the Shell_NotifyIcon API for what I have so far. Here's my current code:
VB Code:
Private Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, pnid 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 Private Const NIM_ADD = &H0 Private Const NIM_MODIFY = &H1 Private Const NIM_DELETE = &H2 Private Const NIF_MESSAGE = &H1 Private Const NIF_ICON = &H2 Private Const NIF_TIP = &H4 Private Const WM_LBUTTONDBLCLK = &H203 Private Const WM_LBUTTONDOWN = &H201 Private Const WM_RBUTTONUP = &H205 Dim NID As NOTIFYICONDATA Private Sub Form_Load() '///System Tray\\\ With NID .cbSize = Len(NID) .hIcon = Me.Icon .hWnd = Me.hWnd .szTip = "Crazy Dave's Security Suite" & vbNullChar .ucallbackMessage = WM_LBUTTONDBLCLK .uFlags = NIF_MESSAGE Or NIF_ICON Or NIF_TIP .uId = 1& End With 'Set the data Shell_NotifyIcon NIM_ADD, NID 'Add the Icon '\\\System Tray/// End Sub




Reply With Quote