Jump to content

Get WinHwd


Recommended Posts

Hi everyone, :). I was trying to get the WinHwd of the current active window so I can use it later on.

Any idea how it works? I tried this way, but it only gets itself's handle. Not other processes.

This is what I did:

Opt("WinTitleMatchMode",4)
HotKeySet("{F11}","GetHandle")
HotKeySet("{F10}","Quit")
While 1
    Sleep(1000)
WEnd
Func GetHandle()
    Local $Title
    Local $Handle
    $Title=WinGetTitle("","")
    $Handle=WinGetHandle($Title,"")
    MsgBox(64,"Handle","Handle is: "&$Handle)
EndFunc
Func Quit()
    Exit
EndFunc

Thanks in advance.

:D

Link to comment
Share on other sites

Look up WinList and WinActive in the help file. Using them together should let you find all the open windows and then loop through them to see which one is active.

...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
Link to comment
Share on other sites

Look up WinList and WinActive in the help file. Using them together should let you find all the open windows and then loop through them to see which one is active.

Is that the only way? I've looked through help file thousands of time.
Link to comment
Share on other sites

Everything in scripting is loops. They seem inefficient, but your computer runs at 1000+ GIGAHERTZ... it can handle it! :)

Is that the only way? I've looked through help file thousands of time.

...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
Link to comment
Share on other sites

Everything in scripting is loops. They seem inefficient, but your computer runs at 1000+ GIGAHERTZ... it can handle it! :)

Yes I understood that, but I am trying to get the current active WinHwd without looping, since WinGetTitle("","") gets the current active Windows Title, so I thought maybe WinGetHandle will do the same. But I realized it doesn't work because the WinTitleMatchMode's parameter is 4.

Anyone got any idea?

Link to comment
Share on other sites

MsgBox(0, "", _WinGetActive())
Func _WinGetActive()
    $local = WinList()
    For $i = 1 to $local[0][0]
        If WinActive($local[$i][1]) Then
            Return $local[$i][0]
        EndIf
    Next
EndFunc
oÝ÷ Ûú®¢×©ä±©hµ8b³
+ç_w¢¹
«­¢+Ø)=ÁÐ ÅÕ½Ðí]¥¹Q¥Ñ±5Ñ¡5½ÅÕ½Ðì°Ð¤)!½Ñ-åMÐ ÅÕ½ÐííÄÅôÅÕ½Ðì°ÅÕ½ÐíÑ!¹±ÅÕ½Ðì¤)!½Ñ-åMÐ ÅÕ½ÐííÄÁôÅÕ½Ðì°ÅÕ½ÐíEÕ¥ÐÅÕ½Ðì¤)]¡¥±Ä(%M±À ÄÀÀÀ¤)]¹)Õ¹Ñ!¹± ¤(%5Í  ½à À°ÅÕ½ÐìÅÕ½Ðì°}]¥¹ÑÑ¥Ù ¤¤)¹Õ¹)Õ¹}]¥¹ÑÑ¥Ù ¤(ÀÌØí±½°ô]¥¹1¥ÍÐ ¤(½ÈÀÌØí¤ôÄѼÀÌØí±½±lÁulÁt(%]¥¹Ñ¥Ù ÀÌØí±½±lÀÌØí¥ulÅt¤Q¡¸(IÑÕɸÀÌØí±½±lÀÌØí¥ulÅt(¹%(9áÐ)¹Õ¹)Õ¹EեР¤(%á¥Ð)¹Õ¹
Link to comment
Share on other sites

Did you see the code i just posted? It returns the title of the window which you can run through "WinGetHandle"

I found out in WinTitleMatchMode Parameter 4 you are unable to get WinHandle by Title, if it does this will just do the job

WinGetTitle("","")
;It gets the title of the current active windows

But thanks again your way worked.

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