我想單擊使用UI自動化的按鈕。我在Winform VC++中使用UI Automation。在VC++的Winform應用程序中使用UI自動化單擊按鈕
這裏是我的代碼..
AutomationElement^ Select_connect_button= aeForm->FindFirst(TreeScope::Children,gcnew PropertyCondition(AutomationElement::NameProperty, "Select/Connect"));
InvokePattern^ ipClickButton1 = (InvokePattern)Select_connect_button->GetCurrentPattern(InvokePattern::Pattern);
ipClickButton1->Invoke();
但它顯示這些錯誤:
error C2440: 'type cast' : cannot convert from 'System::Object ^' to 'System::Windows::Automation::InvokePattern'
error C2440: 'initializing' : cannot convert from 'System::Windows::Automation::InvokePattern' to 'System::Windows::Automation::InvokePattern ^'
任何人可以幫我解決這些錯誤。
謝謝。