Tray Icons and custom shell

G

Guest

Hello,

I've a custom shell and therefore no system tray. I installed a 3rd party
application for WLAN USB Stick, which normally displays a try icon to access
the app and configure the Wlan stick. Now I'm not able to launch the
appropriate application because without system tray the tray icon ins't
visible. Is it possible to launch applications hiding in system tray
programmatically or from command shell (cmd.exe)? Or on the other hand is it
perhaps possible to display the system tray with a custom shell?

Thanks in advance,
Klaus
 
K

KM

Klaus,

Whether you can launch an app from command line or not, completely depends on the app implementation.

It is possible to hide the SysTray but still have the Explorer running in background as a shell. Your custom shell app just needs to
be launched automatically by the Explorer. Some techniques I mentioned here:
http://km-dev.blogspot.com/2007/03/xpe-tip-6-completely-hide-taskbar.html. The down side is that launching Explorer shell increases
the boot time and the footprint of the image in RAM and on disk. It also opens up a security hole in case PC experience is an issue
for your device. Basically you can "disable" Desktop but still have the Taskbar with Notification Area (SysTray) working.

Perhaps it is easier for you find out what command is launched when that systray icon is activated and used. Basically monitor that
application window with a tool like MS Spy++ on the XP Pro install. Very likely that by double-clicking on the icon or by selecting
a context menu item for that icon a message is send to the main window of the app (WM_COMMAND or such). You can always send that
message from your custom app and this way invoke the functions you are looking for.

Often (e.g., for Microsoft components) an item in the context menu for an icon in SysTray launches a control panel applet (with
rundll32 command line). Maybe the same interface is implemented for the WLan driver you are playing with.
 
G

Guest

KM,

I've played something with "Spy++" and the tray icon application and
explored a lot. When I click the icon, a poup menu is displayed which gives
access to all features of the Wlan stick. Every menu item sends a WM_COMMAND
to a non visible window and every item has a distinct command-ID send in
wParam. So it was not very difficult to write a little app, which uses
PostMessage to send the appropriate command to the tray icon window. The
window name I got from Spy, so I could call FindWindow to get the window
handle. Now I'm able to simulate a click on every menu item from the tray
icons popup menu. That's absolutely perfect. I think this method should work
for many other applications, which hide in the system tray. So it is a really
good solution.

Thank you very much for your assistance,
Klaus
 
K

KM

Yup. You got it all right.
This method has been used quite extensively in XP/XPe world. However, please always keep in mind that it is not 100% bullet-proof
approach since some windows can implement non-standard mechanisms for communicating with sys-tray icons (from directly sending
messages to SysTray to forwarding WM_COMMAND event to some other parts or windows of the same app). Also, since you make use of
undocumented messages it may be changed in future versions of the OS and/or apps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top