Just Want To Click On An Icon In The Systray
Posted 17 April 2006 - 06:15 AM
I either need to double click on the icon to open up the program so I can then click the shutdown option. or I need to send a single click to the button while the form is minimized in the Systray.
At this point, I'll take either!
Anyone can point me in the general direction I'd appriciate it. I've run out of ideas.
Note: The icon in the systray is showing up as a Process and not an application however I've been able to use API calls and AutoIt to get the Process ID and then convert it to the windows Hwnd. But then all the ShowWindow, click window, pull my hair out window doesn't work.
Posted 17 April 2006 - 07:53 AM
Opt ("TrayAutoPause", 0)
Opt ("TrayMenuMode", 1)
$guiApp = GUICreate( $appTitel, 200, 200)
$appState = @SW_SHOW
$guiMsg = GUIGetMsg()
$trayMsg = TrayGetMsg()
if Not WinActive($appTitel) And $appState = @SW_SHOW Then ;lost focus minimize window
case $trayMsg = $TRAY_EVENT_PRIMARYDOWN
;Case other function from gui
until $guiMsg = $GUI_EVENT_CLOSE
; User defined function minimize and restore the gui
if $appState = @SW_HIDE then
$appState = @SW_SHOW
$appState = @SW_HIDE
Edited by Micha1405, 17 April 2006 - 07:55 AM.
Posted 17 April 2006 - 11:54 AM
and you may also need Winspector if you want to send direct messages.
And in your example code is wrong idea that you could directly click on Control of hidden window.
If app is in systray this window may be destoyed (and not only hiden) and is created only after tray click.
Posted 17 April 2006 - 12:15 PM
- Somtimes running the program again opens the window. For example, this method works with MSN Messenger to show its window so you can then use WinMenuSelectItem to sign off or close.
Posted 18 April 2006 - 01:52 AM
Trying to find an arbitrary icon from the System Tray is most likely not a simple task. Good luck if you can figure something out. Direct Window messages might work.
Posted 18 April 2006 - 01:58 AM
I found a program that uses Windows Enumeration to list all objects that currently exists along with their class info and such. Working my way down the tree I found the form that I needed and was able to (luckily) use the "TEXT" field to distinguish it from the other forms with the same class name.
Works great now. But the code and notes above sound like the way to go for the proper SysTray handling. This is just a down and dirty quick script for a couple of months until they get the programmer to make some changes.
Thanks again for your attention and time.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users