
System Tray icon with popup menus
I've got a copy of the SysTray control from the Microsoft Website. It allows
Visual Basic programs to place icons in the system tray. I use it all the
time - I find it very useful.
I do have one problem with it though. I often find I need to use popup menus
on this control (otherwise what's the point of having it, right?). So I made
a new version by copying the existing control and adding menu support. This
consisted of adding some variables:
Public MenuLeft as Menu
Public MenuRight as Menu
Public MenuDouble as Menu
And modifying the code that handles mouse clicks to show these menus if
required:
...
If Not (MenuLeft Is Nothing) Then PopupMenu MenuLeft
...
(similar for other two)
However, I find this control very unstable. It often crashes the VB5 IDE.
For instance, if I press the Stop button on VB5 with the icon still in the
tray I get an instant "This program has performed an illegal operation and
will be terminated" message. The same message appears if I click,
right-click or double-click the icon to display it's menu.
I'm not quite sure what to do about it because it's just as unstable in
single-step mode (although this mode might cause a fully functioning program
like this one to crash anyway), and there doesn't seem to be any way to stop
it.
Has anyone else had this problem or know how to fix it. More to the point
does anyone know how I can use icons with menus on them?
--
Paul Evans
[please reply direct to me as well as the newsgroup(s)]
ICQ number: 4135350