Sha256: b04c9b19e44078f821af3590e4ea3f002a45eb1f36cb5bf0624fa6298e7a2e26
Contents?: true
Size: 1.52 KB
Versions: 1
Compression:
Stored size: 1.52 KB
Contents
#include "StdAfx.h" #include "AutomationClicker.h" void AutomationClicker::Click() { if( CanInvoke() ) { return Invoke(); } else if( CanToggle() ) { return Toggle(); } else if( CanSelect() ) { return Select(); } throw gcnew Exception(gcnew String("AutomationElement did not support the InvokePattern, TogglePattern or the SelectionItemPattern")); } void AutomationClicker::MouseClick() { _control->SetFocus(); auto clickablePoint = _control->GetClickablePoint(); Cursor::Position = System::Drawing::Point((int)clickablePoint.X, (int)clickablePoint.Y); mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); } bool AutomationClicker::CanInvoke() { return (bool)(_control->GetCurrentPropertyValue(AutomationElement::IsInvokePatternAvailableProperty)); } void AutomationClicker::Invoke() { dynamic_cast<InvokePattern^>(_control->GetCurrentPattern(InvokePattern::Pattern))->Invoke(); } bool AutomationClicker::CanToggle() { return (bool)(_control->GetCurrentPropertyValue(AutomationElement::IsTogglePatternAvailableProperty)); } void AutomationClicker::Toggle() { dynamic_cast<TogglePattern^>(_control->GetCurrentPattern(TogglePattern::Pattern))->Toggle(); } bool AutomationClicker::CanSelect() { return (bool)(_control->GetCurrentPropertyValue(AutomationElement::IsSelectionItemPatternAvailableProperty)); } void AutomationClicker::Select() { dynamic_cast<SelectionItemPattern^>(_control->GetCurrentPattern(SelectionItemPattern::Pattern))->Select(); }
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rautomation-0.9.1 | ext/UiaDll/UiaDll/AutomationClicker.cpp |