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




//Get the text from Notepad's editor:

GetWindowHandle>Untitled - Notepad,hWnd



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




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

GetWindowHandle>Untitled - Notepad,hWndParent


ObjectSendKeys>hWnd,{"Hello World"}