Jump to content
Sign in to follow this  
ForsakenGod

List of handles ?

Recommended Posts

ForsakenGod

Hello ,

I d like to ask if its possible to do the following : Lets say i have my program that does somethink and i want to run this program 2 times on 2 windows with sure they will have different handles but i d like to ask how to get handles of both windows if they have same name?

Thank you ! :(

Edited by ForsakenGod

Share this post


Link to post
Share on other sites
z0mgItsJohn

Here's a little example code I put together :

ShellExecute ('Notepad'); Run 1st notepad.
ProcessWait ('Notepad.exe'); Wait till its opened.
ShellExecute ('Notepad'); Run 2nd notepad.
Sleep (1000); Wait till 2nd notepad is open.

$HWnDs = _WinGetMultiHWnDs ('Untitled - Notepad'); Get handles of all windows titled "Untitled - Notepad"

ConsoleWrite ('Windows Found : ' & $HWnDs[0] & @CRLF); $HWnDs[0] returns the amout of windows found.

For $A = 1 To $HWnDs[0]
    ConsoleWrite (WinGetTitle ($HWnDs[$A]) & ' - ' & $HWnDs[$A] & @CRLF); Display the results.
Next

Func _WinGetMultiHWnDs ($Title)
$List = WinList ($Title)
Local $Return[$List[0][0] + 1]
$Return[0] = $List[0][0]
For $A = 1 To $List[0][0]
    $Return[$A] = $List[$A][1]
Next
Return $Return
EndFunc

Hope this helps!

- John


Latest Projects :- New & Improved TCP Chat

Share this post


Link to post
Share on other sites
ForsakenGod

Thank youuu ! this is perfect :(

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.