FindObject>parent_handle,ClassName,CaptionText,Instance,return_handle,X1,Y1,X2,Y2,return_text

 

Locates a control given its parent's handle, its class name and either its caption text or instance.  Returns the control's handle, its rectangular bounding screen coordinates and any published caption text.  If an Index is specified the caption text value is ignored.  Where only one object with the given class name exists on the parent window/object instance would be 1.  Where 2 exists, 1 would return the first item and 2 the 2nd.  The order matches the order shown in the View System Windows tool.

 

FindObject can be used in conjunction with SendObjectText and SendObjectKeys to send keystrokes directly to a control.  Use the "Send Keys To Object" wizard to locate the control and generate the code automatically.

 

See also: SendObjectText, SendObjectKeys, GetControlText, SetControlText, SetObjectText

 

Examples:

 

//Get the text from Notepad's editor:

GetWindowHandle>Untitled - Notepad,hWnd

FindObject>hWnd,Edit,,1,hWnd,X1,Y1,X2,Y2,result

 

//Locates the Windows start button, returning its position and caption text

FindObject>0,Shell_TrayWnd,,1,hWnd,X1,Y1,X2,Y2,result

FindObject>hWnd,Button,,1,hWnd,X1,Y1,X2,Y2,result

 

//Send keystrokes directly to Notepad's edit control (Notepad does not require focus)

GetWindowHandle>Untitled - Notepad,hWndParent

FindObject>hWndParent,Edit,,1,hWnd,X1,Y1,X2,Y2,result

ObjectSendKeys>hWnd,{"Hello World"}