Sign in to follow this  
Followers 0
Generator

Get WinHwd

12 posts in this topic

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

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

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

:)

Edited by Senton-Bomb

Share this post


Link to post
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?

Share this post


Link to post
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"

Share this post


Link to post
Share on other sites

But he doesn't want to use loops! Better minds will have to help... :)


...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format

Share this post


Link to post
Share on other sites

But he doesn't want to use loops! Better minds will have to help... :)

Wow, there is so many different ways i could take that... i will just laugh it off :D

Share this post


Link to post
Share on other sites

#10 ·  Posted

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եР¤(%á¥Ð)¹Õ¹

Share this post


Link to post
Share on other sites

#11 ·  Posted

glad i could help... i haven't helped in a while :)

Share this post


Link to post
Share on other sites

#12 ·  Posted

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.

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