Jump to content
Sign in to follow this  
wraithdu

_SysTray UDF

Recommended Posts

Works great on XP, with a small caveat. I created 8 tray icons then killed their processes. But after doing so, the space they occupied was still reserved, so the result was a long and empty-looking systray ;)

Solved that one in a hurry by making a new tray icon for an instant then removing it, which forced the systray to resize (and in a script of yours that already has an icon in the taskbar the solution would be the inverse, TrayIconHide for a moment then back, letting your icon go away for an eyeblink). It'd still be great if the udf itself did that, but i'm fine with it as it is.

Share this post


Link to post
Share on other sites

Nice UDF, I just installed a UPS and its very cumbersome to catch the signal from the UPS software and thus script a graceful exit of running programs.

Incredible as it sounds, the stupid UPS software simply shows balloon tips (aka tool tips) in the system tray (the manual claims to display dialog boxes, but there are no dialog boxes)

So I am using this udf to check the tooltip message every few minutes. It works nicely, except that if the tooltip message changes - the old message continues to be captured, unless the mouse is physically moved over the icon in the tray :|

I can manually write code to move the mouse to update the tooltip, but is there a better way to detect the updated tooltip message?

If I must manually move the mouse, can someone please write example code using _SysTrayIconPos() in this UDF. Sorry, I dont know how to create a struct which will hold the (x,y) return value for this function.

Thanks!

;)

Edited by aria

Share this post


Link to post
Share on other sites

I find that interesting. I just tested on my Win7 x64 system with a volume monitoring script I have which changes the tooltip with volume adjustments. The UDF is correctly retrieving the updated tooltips. My guess is that your application is the culprit. Perhaps somehow it is not updating the tooltip until immediately before it is displayed by the mouseover?

Share this post


Link to post
Share on other sites

The UDF is correctly retrieving the updated tooltips. My guess is that your application is the culprit. Perhaps somehow it is not updating the tooltip until immediately before it is displayed by the mouseover?

Perhaps you are right, this is the APC UPS software (APC Powerchute personal edition).

Its a poor shoddy piece of work - one cant even navigate in their application with the keyboard (as in tabs, etc).

I am using windows 2000 (yeah, old-timer ;)

If you could possibly tell me how to find the icon position using _SysTrayIconPos() , that would be wonderful!

Thanks for replying!

Share this post


Link to post
Share on other sites

Do you know how to get icon pos (who is not visible on tray) from TrayNotifyWnd whan TrayNotifyWnd is opened. I need to get it to click on it and drag it to sTrayIconPos(0) ?

Can you help?

Share this post


Link to post
Share on other sites

You mean on Win7+ in the overflow window? See the below example.

I also fixed a documentation issue in the UDF about the $iWin parameters.

; get the overflow window icon count
$cnt2 = _SysTrayIconCount(2)
ConsoleWrite($cnt2 & @CRLF)
; get icon positions, works even if window is hidden
For $i = 0 To $cnt2 - 1
    $pos = _SysTrayIconPos($i, 2)
    ConsoleWrite($pos[0] & " : " & $pos[1] & @CRLF)
Next

Share this post


Link to post
Share on other sites

Thank you this is great..

I dont really understand what do I do with this

; Parameter(s): $iWin

; | 1 - ToolbarWindow32, Win2000+

; | 2 - NotifyIconOverflowWindow, Win7+

Do i need to manually configure the program to work with windows 7 or windows xp???

Or do I make two different version of my program???

What is win200+ == windows xp - windows vista?

and win7+ == windows7?

Share this post


Link to post
Share on other sites

Depending what you need to do, and what OS's you are targeting, you need to do OS detection and possibly make a second call to your functions.

In Win7+, the NotifyIconOverflowWindow is a new window containing the hidden-but-accessible tray icons. This window doesn't exist in older OS's. I suppose I could add the detection to the UDF, but maybe you only want to target one or the other location for Win7... I don't want to take away that choice.

Share this post


Link to post
Share on other sites

Question about _SysTrayIconRemove ... I have a program I made that run other program invisiable (exp.. It run 1.exe) and its working great with the use of _SysTrayIconRemove I can remove 1.exe trayIcon

But after I exit the program and I want to start 1.exe manually and do see its trayicon its not possible and if I do want to see is try icon again I need to restart my computer...

Is there anyway to fix it? Maybe running a systrayiconunremove of something:?

Thank you

P.S

I tried sysiconhide.. And it working but the problem is that I use this

Run(@ComSpec & " /c taskkill /F /PID " & $q & " /T", @SystemDir, @SW_HIDE)

To kill 1.exe and then when I use it , It does not exit 1.exe systray and I end with 10 invisible systray Icons ...

Thank you

Share this post


Link to post
Share on other sites

Sounds like a problem with your 1.exe / invis tray icon. That function does nothing permanent, and I use it frequently when force killing programs, and the tray icons always reappear when I relaunch the apps.

Share this post


Link to post
Share on other sites

I have several icons in the systray with pid and run the same and I can not tell them apart.

The only thing that is the image distringue.

you can get a list of bmp images of each icon in the systray ?

Eventually I would like to be able to rearrange the icons in the systray under configured list via command line .

Edited by Ontosy

Share this post


Link to post
Share on other sites

Ontosy,

Take a look here - it looks like it might be the solution. :)

M23


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Hi Wraithdu,

A quick question -- where's the latest version of _SysTray UDF script?

As you mentioned it's updated to support Win7 but I could not find the URL for downloading the scripts...

Thanks

Rick

Share this post


Link to post
Share on other sites

wraithdu, I really appreciate the time you took to making this code. The provided example works perfectly right out of the box! All I did was build a x64 GUI exe. This utility is actually irriplacable; considering there are no compiled tiny, light-weight Win32/64 executables do this and that are currently available for download on the Internet. This should be a Windows "must-have" utility!

Share this post


Link to post
Share on other sites

@wraithdu thanks for effort, your UDF is very useful for me too.

I hope you'll add Win 8 support :)

Edited by masvil

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...