Multiple controls of same class type

Class library usage, coding and language questions.
James Hirst
Posts: 21
Joined: Wed Dec 06, 2006 6:24 pm
Location: UK
Contact:

Multiple controls of same class type

Post by James Hirst » Thu Mar 29, 2007 7:25 pm

Hi,

I'm attempting to automate a UI with multiple comboboxes - the problem is that using FormFindChildClassName (which I'm stuck with on the Windows Display Porperties dialog) will just find the first one - using FormFindChildClassName(hWnd, 'ComboBox #1') and FormFindChildClassName(hWnd, 'ComboBox #2') makes no difference!

To put it into context I'm automating the Display and Color Quality comboboxes on the Settings property page of the Desktop Properties dialog.

Any assistance appreciated!

Thanks,
James

webops
Site Admin
Site Admin
Posts: 349
Joined: Wed Jul 05, 2006 7:44 pm

Post by webops » Thu Mar 29, 2007 8:30 pm

You should use the instance number as the third parameter and not in the class name:

Code: Select all

# Find the second combo box
FormFindChildClassName(hWnd, 'ComboBox', 2)
To put it into context I'm automating the Display and Color Quality comboboxes on the Settings property page of the Desktop Properties dialog.
I think it would be better to use the FrmFindChildControlId function, the ControlId is a unique identifier in this dialog.

Jenö Herget
Ranorex Team