Searching a button element by using an handle.


I have the current control handle (a form - may be on VB, or other language).

The form has some buttons.

I want to send an api message WM_CLICK to a specific button,

hence I need to search all the elements on that form, and send the specific button the WM_CLICK message.

Also - I need to “know” what is the caption of the button.

How can I know the above?

Thanks :slight_smile:

Hi Eitan,

You will have to use the FindWindow Window’s api to look for all child controls for the form you have.

You can use the getWindowText Windows api to get the button’s caption.

Google for these and you should be good to get started.

FindWindow returns an handle of a specific class type and title name - I cannot see a way to on WINAPI class on AX to search all elements (by a specific parameter and a loop).

getWindowText return a text by an the handle.

B.T.W is there any way to call any Windows-API function (I see WINAPI is little limited)?

Thanks :slight_smile: