Tech Support > Microsoft Windows > Development Resources > System tray icons? Index query?
System tray icons? Index query?
Posted by Dan on July 9th, 2006


Is there any way I can get the index of a system tray icon that I've
created? My application creates more than one icon which must be next
to each other and in the correct order. As my application will
generally be loaded up at Window's startup - sometimes I get other
icons appearing inbetween my app's icons. Also with WindowsXP, it
seems to create the icons from right to left, not from left to right
like Win2k does. Being able to query for an icon index would be ideal.

Thanks for any help,
- Dan

Posted by Eric Jensen on July 10th, 2006



"Dan" <dracan2@googlemail.com> wrote in message
news:1152445320.491355.25290@s13g2000cwa.googlegro ups.com...

I'm not sure - but no.

[snip]
Shell_NotifyIcon() (please excuse if i remember the api name incorectly)
takes a struct as parameter. In that struct you can define the version of
the taskbar, to ensure its behavior is the same an older version.

You can probably use FindWindow() and simular to locate the tray and your
icon and obtain the index that way.

e.g. FindWindow("Shell_TrayWnd", 0);

//eric



Posted by Steve on July 14th, 2006


Dan wrote:
Yes you can.

Try this link: http://www.codeproject.com/tools/ShellTrayInfo.asp

Bear in mind, that if the end user is using a different desktop shell
other than Explorer, this will not work.

Posted by Steve on July 14th, 2006


Eric Jensen wrote:
That parameter you mention is for defining the behaviour of the icon
itself and not the tray. It seems that XP & 2000, although they receive
the icons in the same order, they draw the tray opposite to each other.
Not much you can do about that.


Similar Posts