Sign in to follow this  
Followers 0
horohoro

Control with the same class

15 posts in this topic

Hi all, i have a problem i dont know how to access 2 controls with the same classes. I have for example a program opened 2 times. If i try to access a control from it doesent click on the class i want because there is the second instance with the same class. Please anyone if know how to solve this problem i will thank very much. Have a nice night all and sorry for my very bad english

Share this post


Link to post
Share on other sites



Hi all, i have a problem i dont know how to access 2 controls with the same classes. I have for example a program opened 2 times. If i try to access a control from it doesent click on the class i want because there is the second instance with the same class. Please anyone if know how to solve this problem i will thank very much. Have a nice night all and sorry for my very bad english

Take a look to from PsaltyDS

by this way you will differenciate the 2 windows with same class Posted Image


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I tried :

$pid = processexists("notepad.exe")
$vis = WinHandFromPID($pid, "", 8)
msgbox(0,0, $vis[1])

and nothing returns only an error of function.

I dont know how to use the function can you please post an example ?

Edited by horohoro

Share this post


Link to post
Share on other sites

#Include <WinAPIEx.au3>

The header file winapiex.au3 is not present in my autoit dir and the code returns error

"C:\Documents and Settings\HOROHORO-Killer\Desktop\new.au3 (5) : ==> Unknown function name.:

$Data = _WinAPI_EnumProcessWindows ( $_Pid )"

Can you please tell me where i can find WinAPIEx.au3 download link because is not included in autoit install kit

Share this post


Link to post
Share on other sites

Do you know Google search ? Posted Image


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Do you know Google search ? Posted Image

msgbox(0,0, $Data[1][0])

Thanks for the link but the only thing returns is :

Row | Col 0 | Col 1

[0] | 1

[1] | 0x000B038C | Notepad

What can i do with this info ? 0x000B is the handle of wich class? I have two notepad open and thats the only info it gives me

Edited by horohoro

Share this post


Link to post
Share on other sites

yes it return the handle of the window and his title !

like this you can send command to a precise window

and not to the both ! Posted Image


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

I think it should return 2 handles of window because i have two notepads opened. Each window has a different hwnd and it returns only one and the same. I am still confused :unsure:

Edited by horohoro

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Do you have an idea how can i discover all the class names beginning with a certain string? I ask you this coz my program changes his window class with a string like this "adt:css:$randomnumbers" everytime i open it.

Edited by horohoro

Share this post


Link to post
Share on other sites

I think it should return 2 handles of window because i have two notepads opened. Each window has a different hwnd and it returns only one and the same. I am still confused :unsure:

1 you must run 1 instance of notepad and get his handle

2 you run second instance of notepad and get the second hanle...Posted Image


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

I only need to discover hwnd-s when are both opened at the same time. Thanks anyway coz u offered to help me up here.

Edited by horohoro

Share this post


Link to post
Share on other sites

1 you must run 1 instance of notepad and get his handle

2 you run second instance of notepad and get the second hanle...Posted Image

So I gather that it is not possible to get the handle of a specific window given that there are multiple instances of it?

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

I only need to discover hwnd-s when are both opened at the same time. Thanks anyway coz u offered to help me up here.

I don't see how differenciate both windows if they have same class, same title and if you don't know which pid correspond to any window !

What's type of soft window ?

who start this processes ?

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

I don't see how differenciate both windows if they have same class, same title and if you don't know which pid correspond to any window !

What's type of soft window ?

who start this processes ?

I open the software manually and his window class name is changing everytime i open it to a fixed string combined with some random numbers. The program have the same title everytime i open a new instance.

Edited by horohoro

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