I'm trying to use UI Automation to click a simple button in a 3rd party application. I have initialized the IUIAutomation object and retrieved an IUIAutomationElement by using the ElementFromHandle() function with the handle of the 3rd party application window.
But I really can't figure out how to use this IUIAutomationElement to find the button and issue a leftbutton click on it..
This is my code so far:
void Control::clickButton()
{
for (std::list<Window>::iterator i = mainDetector.getWindowList().begin(); i != mainDetector.getWindowList().end(); ++i)
{
if (i->getTitle().find("PokerStars Lobby") != std::string::npos)
{
parentWindowHandle = (HWND)i->getHandle();
}
}
InitializeUIAutomation(iUiAutomation);
(*iUiAutomation)->ElementFromHandle(parentWindowHandle, iUiAutomationElement);
}
Hope someone can help me how to continue from here to actually click the button