tags:

views:

40

answers:

1

I have a program that needs to check the state of an icon in the system tray. The program in the system tray swaps it's icon depending on it's communication status with the server and I need to check which Icon it is using right now. I found a way to extract the current icon, but how do I check which Icon that is?

A: 

I assume you mean you want to do a check the contents of the icon itself, as in the image contents.

If this is the case, then there are a number of image comparison algorithms that you can use.

However, that might be a little overkill. Since the icons are so small, you might want to determine a pixel or groups of pixels that can be checked for the state, because you might know that they will always be in a certain unique state given the icon.

casperOne
Okay, I may have left some unclear points in my OP let me try to clear it up some. I have an application that I have no control of in the System Tray. It changes icon depending on its connection state to a device. Checking the port to the device causes system lockup on several machines and I can think of no other way to gather the current state of the application then by looking at it's icon. The Icon is covered up by my application and I want a status "light" indicating whether the program is communicating with the Device.
LordMage
Here is the method I found for getting the icon Icon.ExtractAssociatedIcon(theProcess.MainModule.FileName); Maybe not the best. but It gets the icon. I have no idea at this point to check which icon it is and determine state from that. I was hoping for a way to get a handle name or hash that would identify the icon through it's extraction. maybe not though. If anyone has a better solution please let me know.
LordMage