Sha256: f167766417fe634296febd4ff1182d3d3015376bac8eab5acea52e4e3d67542e

Contents?: true

Size: 933 Bytes

Versions: 1

Compression:

Stored size: 933 Bytes

Contents

#include "StdAfx.h"
#include "AutomationControl.h"
#include "AutomationFinder.h"

AutomationControl::AutomationControl(const HWND windowHandle)
{
	_control = AutomationElement::FromHandle(IntPtr(windowHandle));
}

AutomationControl::AutomationControl(const FindInformation& findInformation)
{
	try {
		auto rootElement = AutomationElement::FromHandle(IntPtr(findInformation.rootWindow));
		auto finder = gcnew AutomationFinder(rootElement);
		_control = finder->Find(findInformation);
	}
	catch(Exception^ e) {
		Debug::WriteLine("AutomationControl error:  {0}", e->Message);
	}
}

void AutomationControl::Value::set(String^ value) {
	AsValuePattern->SetValue(value);
}

String^ AutomationControl::Value::get() {
	return AsValuePattern->Current.Value;
}

bool AutomationControl::IsValuePattern::get() {
  try {
    return nullptr != AsValuePattern;
  } catch(Exception^ e) {
    return false;
  }
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rautomation-0.9.2 ext/UiaDll/UiaDll/AutomationControl.cpp