We help IT Professionals succeed at work.

system tray

Ryan9999
Ryan9999 asked
on
Medium Priority
246 Views
Last Modified: 2006-11-17
i know how to find the handle of the system tray

SysTrayhWnd = FindWindowEx(FindWindow("Shell_TrayWnd", ""), 0, "traynotifywnd","")

my problem is how do i hook to it so i know when it changes sizes (icon is added or deleted.)

Comment
Watch Question

Richie_SimonettiIT Operations
CERTIFIED EXPERT

Commented:
Ryan ChongSoftware Tead Lead / Business Analyst / System Analyst / Data Engineer
CERTIFIED EXPERT

Commented:
Hi Ryan9999,

A tray icon application without subclassing, encapsulated into a single form, and with all of the common system tray features:

http://www.freevbcode.com/ShowCode.Asp?ID=2055

'Hope will help.
CERTIFIED EXPERT
Commented:
Hi
You can not subclass window in different process - SetWindowLong simply return ) to you. Instead, you can create new window with "Shell_TrayWnd" class and then send registered message "TaskbarCreated"
to all windows (HWND_BROADCAST). All good applications should update their icon in tray. Since you own
this window I can subclass it and wait for WM_COPYDATA and store NOTIFAYICON data in array/collection.
Another way is to use SetParent for Tray window.

BTW, sample for Richie's link is available at http://www.freevbcode.com/ShowCode.Asp?ID=3291

Cheers
Richie_SimonettiIT Operations
CERTIFIED EXPERT

Commented:
Ark is right (since EE link points to his question and use it in your own post at www.freevbcode.com).
I didn't do a post to his link since i missed it.
As always, good wirk from Ark.
Cheers.

Explore More ContentExplore courses, solutions, and other research materials related to this topic.