-
I haven't seen this mentioned on here so I thought I'd post it in case it was useful to anyone..
The code given elsewhere on this site for setting up a system tray icon uses a form menu for it's context menu when you right click on the icon. One problem can be that VB doesn't allow a form with a menu on it to be borderless.
The way I found around this is to have a second form which contains all the tray icon code. In the form load of Form1 you use Load Form2 to setup the tray icon and in the unload code of Form1 use Unload Form2 and then the code in the unload section of Form2 will take care of cleaning up after the tray icon.
-
<?>
Haven't tried this for systray but it works for taskbar
Code:
'Show the icon of a titleless form in taskbar tray
Private Declare Function SetWindowLong Lib "user32" _
Alias "SetWindowLongA" (ByVal hwnd As Long, _
ByVal nIndex As Long, ByVal dwNewLong As Long) _
As Long
Private Const GWL_STYLE = (-16)
Private Const WS_SYSMENU = &H80000
'<<<<<< Form load >>>>>>
Private Sub Form_Load()
Call SetWindowLong(Me.hwnd, GWL_STYLE, WS_SYSMENU)
End Sub