Sign in to follow this  
Followers 0
shEiD

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

10 posts in this topic

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.

Share this post


Link to post
Share on other sites



It would be pretty easy to translate the functions to C#. I'll give it a stab later today after I take a nap.

Share this post


Link to post
Share on other sites

Thank you in advance. I'm still too green to do that myself.

Share this post


Link to post
Share on other sites

Working on this right now (had few busy days with family due to holiday). I've got everything except the text reading function finished and it shouldn't be much longer.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Ok, it's taking longer than expected. Gonna finish tomorrow.

Started talking to girlfriend on the phone and I got distracted and now it's two in the morning. :sweating:

Edited by Richard Robertson

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

@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.

Share this post


Link to post
Share on other sites

Well make sure you get those files and save them somewhere because I'll probably remove them from my Dropbox next time I clean up.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

If you are automating a web page, it might be easier to actually insert jQuery and use the tooltip widget here http://api.jqueryui.com/tooltip/

Share this post


Link to post
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
Sign in to follow this  
Followers 0

  • Similar Content

    • Luigi
      By Luigi
      Greetings, someone can give a exemple, how send a error from a C#'s dll to AutoIt?
      I use this line, to send an error... but, I want get a error code In AutoIt with macro @error, it's possible?
       
      throw new ArgumentException("arquivo map não existe", "value" ); In this way, work, I know ther are error, but, @errror always is zero.
      I don't want this, I want a number as error code.
      Can you help me?
       
      Best regards
    • breakbadsp
      By breakbadsp
      AutoIT AU3info doeas not detect all gui objects uniquely for .NET GUIs developed in C#.
      this is not working now i am using COM windows approach for this, But its very difficult.
      Please let me know if anyone has done it before.
    • 5ervant
      By 5ervant
      What's the best way to receive file from a desktop app?
      app.exe will execute a cmd with "au3file.exe /path/of/the/file.xml" and the au3file.exe will get and delete that. Or else? THE MOST IMPORTANT PART OF THE QUESTION
      And best way to transfer file to a desktop app?
      au3file.exe do a $_POST request and the app.exe MUST HAVE a local HTTP server that can receive $_POST, but it looks heavy 'cause the app must have a server such XAMPP. au3file.exe execute a cmd with "app.exe /path/of/the/file.xml" and the app.exe will now get that file and delete. Or else?  
    • ALIENQuake
      By ALIENQuake
      Hello everyone,
      Finally I decide to ask hard question about one of the project which I currently maintain:
      Big World Setup aka mod installer for infinity engine games like BG, IWD, PST etc
      Project page: https://bitbucket.org/BigWorldSetup/bigworldsetup/overview
      More screenshot: https://forums.beamdog.com/discussion/44476/tool-big-world-setup-bws-mod-manager-for-baldurs-gate-enhanced-edition-trilogy-for-windows/p1
      General Features
      downloading mods (please see remarks!) easy mod installation correct install order of mods/components handle mod and components conflicts and auto solve them easy backup creation/restoring ability to add you own mods Internal Features (every single feature which you see here is already working in autoit)
       
      It look as simple GUI application but it has quite complicated logic regarding "handle mod and components conflicts and auto solve them" - this is most important feature of the app.
      This app needs to be converted into multi-platform GUI application because Enhanced Editions of the game can be played on OSX and Linux also. But for the past 6 years, there wasn't a single gamer/developer who would try to convert this app using multi-platform language and GUI. 
      This is the moment when I'm asking for help:
      - Which language would suit the best for multi-platform GUI application?  c#,python,java or other?
      - Is there any general approach for such conversion? 
      - Does autoit community/developer have some experience with converting autoit GUI applications into multi-platform GUI app by using multi-platform language like c#,python,java
      - Is there someone who isn't scared by looking at the source code of the application and feature list to help me with converting or even begin with creating multi-platform GUI app template which will just simply run the same commandline for every system ? 
      If there is something else which you would know, pleas ask and I will try to answer my best.
       
    • Rishav
      By Rishav
      Hi
      Returning to AutoIt after a few years.
      I wanted to add a custom counter to the system tray.
      The long term plan is to add a simple monitor (could be another clock, cpu temp, cpu usage etc), but for now I just want to add a simple counter which increments by 1 every tick and resets to 0 after 1000.
      I tried searching but most relevant post seem to be over 5 years old.
      Can someone point me in the right direction?