Jump to content

C# - get info (tool-tips) of System Tray icons.


shEiD
 Share

Recommended Posts

Hi, could anyone help me with a C# code to get info of icons in System Tray? I can accomplish this in AutoIt, but would very much prefer to be able to have this in c#. I use it daily, to fix some problems/bugs in another software to make it usable, which is in beta now, and until developers fix it, I need to resort to this thing. Crazy enough, there is no other way inbuilt to get the status of a program and what it's doing, except tray icon. No logging, anything at all. They say they are working on it, but until that time...
Here's the AutoIt snippet:
#include <GuiToolBar.au3>
 
$hTray = ControlGetHandle('[Class:Shell_TrayWnd]', '', '[Class:ToolbarWindow32;Instance:1]')
$iconCount = _GUICtrlToolbar_ButtonCount($hTray)
For $i = 0 To $iconCount - 1
$text = _GUICtrlToolbar_GetButtonText($hTray, $i)
ConsoleWrite($text & @LF)
Next

The most important thing, is to get tray icon tool-tip. I would like to get more, if possible as well, but tool-tip is crucial.

I'm a hobbyist and only learning programming (C#). I don't know c++, nor I know how to properly PInvoke in c#, and I'm not confident enough to mess with unmanaged code.
 
I even tried to accomplish this in C# using AutoItX3_x64.dll, but could not figure it out.
Any help would be much appreciated. Maybe at least someone could tell me, where else I could ask for help on this, if not here?
 
Autoit is awesome, I use it daily, sadly this project is just too big and complicated to do it all in Autoit only. Main reason - I want to use WPF.
Link to comment
Share on other sites

https://dl.dropboxusercontent.com/u/22618541/ToolTipsHelper.cs

https://dl.dropboxusercontent.com/u/22618541/Program.cs

ToolTipsHelper.cs contains a class that has the functions you need.

Program.cs shows how to call it, basically emulating the script fragment above.

Sorry it took so long, but like I said, it was a busy weekend and the last function (that gets the text) was significantly more complex than the others.

Edited by Richard Robertson
Link to comment
Share on other sites

  • 3 weeks later...

@Richard Robertson,

Thank You so much. Sorry I haven't been back here for so long. I have asked this question someplace else, and another very helpful person wrote a wrapper dll for me, so I've been using that. But I will go though your solution and examine it and maybe use it. Anyway it will help me a lot as a learning example, so your hard work will not be wasted.

Thank you again.

Link to comment
Share on other sites

  • 6 months later...

Thanks for the solution!

Is there any way to Display a balloon like ToolTip on screen similar to AutoIt ToolTip in C#?

I have used the AutoItX.ToolTip for C# but it is not showing the ToolTip on my windows 8 machine.

Also, it has no option for balloon like tips.

My intention is to show a tooltip near an IE DOM Element using the x, y position, I am working on WatiN Web UI Automation framework.

Thanks for your help.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...