System Tray icon with popup menus 
Author Message
 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



Sat, 10 Aug 2002 03:00:00 GMT  
 System Tray icon with popup menus

Quote:
>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.

Paul,

I guess the sample uses subclassing. That means, DON'T hit the Stop
button, and DON'T use the End statement. Tha's asking for trouble. To
end the program, unload all Forms.

Mattias

__________________________________________________

     VB+ http://hem.spray.se/mattias.sjogren/
 Please send questions/replies to the newsgroups



Sat, 10 Aug 2002 03:00:00 GMT  
 System Tray icon with popup menus
What about making a new control, and using the old one as a component on it.
I can redirect most property / methods to the old one, and capture mouse
events to show a menu, before passing them on to the container. Would that
work?

--
Paul Evans



ICQ number: 4135350

Quote:
> I guess the sample uses subclassing. That means, DON'T hit the Stop
> button, and DON'T use the End statement. Tha's asking for trouble. To
> end the program, unload all Forms.



Wed, 14 Aug 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. TaskIcon.OCX for show icon and popup menu in system tray

2. Popup menu on system Tray Icon

3. How to release Popup Menu from system tray?

4. Popup Menu in System Tray

5. popup menu in system tray

6. Popup menu in System tray

7. System Tray Popup Menu fails Under Win95 (Q176085)

8. How to kill a Popup Menu in the System Tray

9. accelerator keys for system tray popup menu not working

10. hide system tray popup menu

11. Popup Menu in System Tray

12. Popup Menu for Icon in Sys Tray

 

 
Powered by phpBB® Forum Software