Jump to content

WinGetHandle and System Tray


Recommended Posts

Hi,

I cannot get the handle of the system tray with WinGetHandle(), while this is possible with WIN API FindWindow(). Is this intentional, a bug or did I something wrong?

System: WinXP SP2, AutoIT 3.2.2.0

Sample code

; THIS RETURNS THE HANDLE OF THE SYSTEM TRAY

$retval = DllCall("user32.dll","hwnd","FindWindow","str","Shell_TrayWnd","str","")

if @error then
    MsgBox(0,"ERROR","DLLCALL error")
    exit
endif

$tray_handle = $retval[0]
MsgBox(0,"TRAY Handle",String($tray_handle))

; THIS DOES <<NOT>> RETURN THE HANDLE OF THE SYSTEM TRAY

$tray_handle = WinGetHandle("Shell_TrayWnd")
;$tray_handle = WinGetHandle("classname=Shell_TrayWnd")   ; neither of these methods do work

if @error then
    MsgBox(0,"ERROR","no windows found")
    exit
endif
MsgBox(0,"TRAY Handle",String($tray_handle))

Thanks

Kurt

Edited by /dev/null

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Link to comment
Share on other sites

Tsk, tsk. That isn't how you search for a classname in AutoIt. You're missing the "classname=" part. You're also not setting WinTitleMatchMode to 4.

damn!! I knew there is something I forgot....

Opt("WinTitleMatchMode", 4) did the job together with "classname=" (which I already had in my code!)

EDIT: you can move this to support if you like.

Thanks

Kurt

Edited by /dev/null

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...