WPF and regular Win32 windows are now supported
Added support for dragging target on WPF windows and building simple xpath statements. Fixed some null results in native library and increased performance of enumerating wpf windows. Still need to tweak filters for picking up Silverlight handles too.
This commit is contained in:
@@ -37,7 +37,7 @@ using namespace System::Security::Permissions;
|
||||
// You can specify all the value or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly:AssemblyVersionAttribute("1.0.*")];
|
||||
[assembly:AssemblyVersionAttribute("1.1.*")];
|
||||
|
||||
[assembly:ComVisible(false)];
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ using namespace System::Windows::Automation;
|
||||
WpfAutomation::WpfAutomation(void)
|
||||
{
|
||||
this->frameworkId = WpfAutomation::DEFAULT_FRAMEWORK;
|
||||
this->touchableOnly = true;
|
||||
}
|
||||
|
||||
void WpfAutomation::setFrameworkId(System::String ^propertyValue)
|
||||
@@ -20,6 +21,21 @@ void WpfAutomation::setFrameworkId(System::String ^propertyValue)
|
||||
this->frameworkId = propertyValue;
|
||||
}
|
||||
|
||||
void WpfAutomation::setTouchableOnly(System::Boolean val)
|
||||
{
|
||||
this->touchableOnly = val;
|
||||
}
|
||||
|
||||
System::Windows::Automation::Condition ^ WpfAutomation::getSearchConditions()
|
||||
{
|
||||
array<System::Windows::Automation::Condition ^> ^cons = gcnew array<System::Windows::Automation::Condition ^>(3);
|
||||
cons[0] = gcnew PropertyCondition(AutomationElement::FrameworkIdProperty, this->frameworkId);//is WPF framework
|
||||
cons[1] = gcnew PropertyCondition(AutomationElement::IsEnabledProperty, this->touchableOnly);//is enabled
|
||||
cons[2] = gcnew PropertyCondition(AutomationElement::IsOffscreenProperty, !this->touchableOnly);// is off screen
|
||||
System::Windows::Automation::Condition ^result = gcnew System::Windows::Automation::AndCondition(cons);
|
||||
return result;
|
||||
}
|
||||
|
||||
array<System::Int32> ^ WpfAutomation::convertRuntimeIdString(System::String ^runtimeIdValue)
|
||||
{
|
||||
System::String ^delim = L"-";
|
||||
@@ -37,9 +53,9 @@ AutomationElement ^ WpfAutomation::findAutomationElementById(System::String ^run
|
||||
if (runtimeIdValue == nullptr || runtimeIdValue->Equals(L""))
|
||||
return AutomationElement::RootElement;
|
||||
array<System::Int32> ^idArray = this->convertRuntimeIdString(runtimeIdValue);
|
||||
Condition ^pcFramework = gcnew PropertyCondition(AutomationElement::FrameworkIdProperty, this->frameworkId);
|
||||
//Condition ^pcFramework = gcnew PropertyCondition(AutomationElement::FrameworkIdProperty, this->frameworkId);
|
||||
Condition ^pcRunId = gcnew PropertyCondition(AutomationElement::RuntimeIdProperty, idArray);
|
||||
Condition ^frameworkAndRuntimeId = gcnew AndCondition(pcFramework, pcRunId);
|
||||
Condition ^frameworkAndRuntimeId = gcnew AndCondition(getSearchConditions(), pcRunId);
|
||||
return AutomationElement::RootElement->FindFirst(TreeScope::Descendants, frameworkAndRuntimeId);
|
||||
}
|
||||
|
||||
@@ -76,7 +92,9 @@ System::String ^ WpfAutomation::getRuntimeIdFromElement(System::Windows::Automat
|
||||
System::Int32 WpfAutomation::countDescendantWindows()
|
||||
{
|
||||
//AutomationElementCollection ^aec = rootElem->FindAll(TreeScope::Children, Condition::TrueCondition);
|
||||
AutomationElementCollection ^aec = AutomationElement::RootElement->FindAll(TreeScope::Descendants, gcnew PropertyCondition(AutomationElement::FrameworkIdProperty, this->frameworkId));
|
||||
AutomationElementCollection ^aec = AutomationElement::RootElement->FindAll(TreeScope::Descendants, getSearchConditions());
|
||||
if (aec == nullptr)
|
||||
return 0;
|
||||
System::Int32 result = aec->Count;
|
||||
//delete aec;
|
||||
return result;
|
||||
@@ -85,7 +103,9 @@ System::Int32 WpfAutomation::countDescendantWindows()
|
||||
System::Int32 WpfAutomation::countDescendantWindows(System::String ^runtimeIdValue)
|
||||
{
|
||||
AutomationElement ^parent = findAutomationElementById(runtimeIdValue);
|
||||
AutomationElementCollection ^aec = parent->FindAll(TreeScope::Descendants, gcnew PropertyCondition(AutomationElement::FrameworkIdProperty, this->frameworkId));
|
||||
AutomationElementCollection ^aec = parent->FindAll(TreeScope::Descendants, getSearchConditions());
|
||||
if (aec == nullptr)
|
||||
return 0;
|
||||
System::Int32 result = aec->Count;
|
||||
//delete aec;
|
||||
//delete frameworkAndRuntimeId;
|
||||
@@ -95,7 +115,9 @@ System::Int32 WpfAutomation::countDescendantWindows(System::String ^runtimeIdVal
|
||||
System::Int32 WpfAutomation::countChildrenWindows()
|
||||
{
|
||||
//AutomationElementCollection ^aec = rootElem->FindAll(TreeScope::Children, Condition::TrueCondition);
|
||||
AutomationElementCollection ^aec = AutomationElement::RootElement->FindAll(TreeScope::Children, gcnew PropertyCondition(AutomationElement::FrameworkIdProperty, this->frameworkId));
|
||||
AutomationElementCollection ^aec = AutomationElement::RootElement->FindAll(TreeScope::Children, getSearchConditions());
|
||||
if (aec == nullptr)
|
||||
return 0;
|
||||
System::Int32 result = aec->Count;
|
||||
//delete aec;
|
||||
return result;
|
||||
@@ -104,7 +126,9 @@ System::Int32 WpfAutomation::countChildrenWindows()
|
||||
System::Int32 WpfAutomation::countChildrenWindows(System::String ^runtimeIdValue)
|
||||
{
|
||||
AutomationElement ^parent = findAutomationElementById(runtimeIdValue);
|
||||
AutomationElementCollection ^aec = parent->FindAll(TreeScope::Children, gcnew PropertyCondition(AutomationElement::FrameworkIdProperty, this->frameworkId));
|
||||
AutomationElementCollection ^aec = parent->FindAll(TreeScope::Children, getSearchConditions());
|
||||
if (aec == nullptr)
|
||||
return 0;
|
||||
System::Int32 result = aec->Count;
|
||||
//delete aec;
|
||||
//delete frameworkAndRuntimeId;
|
||||
@@ -114,14 +138,18 @@ System::Int32 WpfAutomation::countChildrenWindows(System::String ^runtimeIdValue
|
||||
array<System::String ^> ^ WpfAutomation::enumChildrenWindowIds(System::String ^runtimeIdValue)
|
||||
{
|
||||
AutomationElement ^parent = findAutomationElementById(runtimeIdValue);
|
||||
AutomationElementCollection ^aec = parent->FindAll(TreeScope::Children, gcnew PropertyCondition(AutomationElement::FrameworkIdProperty, this->frameworkId));
|
||||
AutomationElementCollection ^aec = parent->FindAll(TreeScope::Children, getSearchConditions());
|
||||
if (aec == nullptr)
|
||||
return nullptr;
|
||||
return getRuntimeIdsFromCollection(aec);
|
||||
}
|
||||
|
||||
array<System::String ^> ^ WpfAutomation::enumDescendantWindowIds(System::String ^runtimeIdValue)
|
||||
{
|
||||
AutomationElement ^parent = findAutomationElementById(runtimeIdValue);
|
||||
AutomationElementCollection ^aec = parent->FindAll(TreeScope::Descendants, gcnew PropertyCondition(AutomationElement::FrameworkIdProperty, this->frameworkId));
|
||||
AutomationElementCollection ^aec = parent->FindAll(TreeScope::Descendants, getSearchConditions());
|
||||
if (aec == nullptr)
|
||||
return nullptr;
|
||||
return getRuntimeIdsFromCollection(aec);
|
||||
}
|
||||
|
||||
@@ -131,22 +159,27 @@ array<System::String ^> ^ WpfAutomation::enumDescendantWindowIds(System::Int32 p
|
||||
gcnew PropertyCondition(AutomationElement::FrameworkIdProperty, this->frameworkId),
|
||||
gcnew PropertyCondition(AutomationElement::ProcessIdProperty, processId));
|
||||
AutomationElement ^parent = AutomationElement::RootElement->FindFirst(TreeScope::Descendants, frameworkAndProcessId);
|
||||
AutomationElementCollection ^aec = parent->FindAll(TreeScope::Descendants, gcnew PropertyCondition(AutomationElement::FrameworkIdProperty, this->frameworkId));
|
||||
AutomationElementCollection ^aec = parent->FindAll(TreeScope::Descendants, getSearchConditions());
|
||||
if (aec == nullptr)
|
||||
return nullptr;
|
||||
return getRuntimeIdsFromCollection(aec);
|
||||
}
|
||||
|
||||
array<System::String ^> ^ WpfAutomation::EnumDescendantWindowIdsFromHandle(System::IntPtr windowHandle)
|
||||
System::String ^ WpfAutomation::getRuntimeIdFromHandle(System::IntPtr windowHandle)
|
||||
{
|
||||
//AutomationElement test = AutomationElement.FromHandle(new System.IntPtr(123123));
|
||||
AutomationElement ^parent = AutomationElement::FromHandle(windowHandle);
|
||||
AutomationElementCollection ^aec = parent->FindAll(TreeScope::Descendants, gcnew PropertyCondition(AutomationElement::FrameworkIdProperty, this->frameworkId));
|
||||
return getRuntimeIdsFromCollection(aec);
|
||||
AutomationElement ^target = AutomationElement::FromHandle(windowHandle);
|
||||
if (target == nullptr)
|
||||
return nullptr;
|
||||
return getRuntimeIdFromElement(target);
|
||||
}
|
||||
|
||||
array<System::String ^> ^ WpfAutomation::EnumDescendantWindowInfo(System::String ^runtimeIdValue, System::String ^properties)
|
||||
array<System::String ^> ^ WpfAutomation::enumDescendantWindowInfo(System::String ^runtimeIdValue, System::String ^properties)
|
||||
{
|
||||
AutomationElement ^parent = findAutomationElementById(runtimeIdValue);
|
||||
AutomationElementCollection ^aec = parent->FindAll(TreeScope::Descendants, gcnew PropertyCondition(AutomationElement::FrameworkIdProperty, this->frameworkId));
|
||||
if (parent == nullptr)
|
||||
return nullptr;
|
||||
AutomationElementCollection ^aec = parent->FindAll(TreeScope::Descendants, getSearchConditions());
|
||||
|
||||
//create array for keeping order of properties
|
||||
System::String ^delim = L",";
|
||||
@@ -213,9 +246,19 @@ array<System::String ^> ^ WpfAutomation::EnumDescendantWindowInfo(System::String
|
||||
return winInfoList;
|
||||
}
|
||||
|
||||
System::String ^ WpfAutomation::getRuntimeIdFromPoint(System::Int32 x, System::Int32 y)
|
||||
{
|
||||
AutomationElement ^target = AutomationElement::FromPoint(System::Windows::Point(x,y));
|
||||
if (target == nullptr)
|
||||
return nullptr;
|
||||
return getRuntimeIdFromElement(target);
|
||||
}
|
||||
|
||||
System::String ^ WpfAutomation::getParentRuntimeId(System::String ^runtimeIdValue)
|
||||
{
|
||||
AutomationElement ^target = findAutomationElementById(runtimeIdValue);
|
||||
if (target == nullptr)
|
||||
return nullptr;
|
||||
TreeWalker ^tw = TreeWalker::ControlViewWalker;
|
||||
AutomationElement ^parent = tw->GetParent(target);
|
||||
return getRuntimeIdFromElement(parent);
|
||||
@@ -224,6 +267,8 @@ System::String ^ WpfAutomation::getParentRuntimeId(System::String ^runtimeIdValu
|
||||
System::String ^ WpfAutomation::getProperty(System::String ^propertyName, System::String ^runtimeIdValue)
|
||||
{
|
||||
AutomationElement ^parent = findAutomationElementById(runtimeIdValue);
|
||||
if (parent == nullptr)
|
||||
return nullptr;
|
||||
//System::Object ^currentVal = parent->GetCurrentPropertyValue(AutomationElement::RuntimeIdProperty);
|
||||
array<AutomationProperty^> ^aps = parent->GetSupportedProperties();
|
||||
for each(AutomationProperty ^ap in aps)
|
||||
@@ -238,9 +283,12 @@ System::String ^ WpfAutomation::getProperty(System::String ^propertyName, System
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
array<System::String ^> ^ WpfAutomation::getProperties(System::String ^runtimeIdValue)
|
||||
{
|
||||
AutomationElement ^parent = findAutomationElementById(runtimeIdValue);
|
||||
if (parent == nullptr)
|
||||
return nullptr;
|
||||
array<AutomationProperty^> ^aps = parent->GetSupportedProperties();
|
||||
array<System::String ^> ^propStrArray = gcnew array<System::String ^>(aps->Length);
|
||||
System::Int32 count = 0;
|
||||
@@ -258,6 +306,8 @@ array<System::String ^> ^ WpfAutomation::getProperties(System::String ^runtimeId
|
||||
array<System::String ^> ^ WpfAutomation::getPropertiesAndValues(System::String ^runtimeIdValue)
|
||||
{
|
||||
AutomationElement ^parent = findAutomationElementById(runtimeIdValue);
|
||||
if (parent == nullptr)
|
||||
return nullptr;
|
||||
array<AutomationProperty^> ^aps = parent->GetSupportedProperties();
|
||||
array<System::String ^> ^propStrArray = gcnew array<System::String ^>(aps->Length);
|
||||
System::Int32 count = 0;
|
||||
|
||||
@@ -11,6 +11,7 @@ public ref class WpfAutomation
|
||||
public:
|
||||
WpfAutomation(void);
|
||||
void setFrameworkId(System::String ^propertyValue); //default is WPF, but also accepts Silverlight, Win32
|
||||
void setTouchableOnly(System::Boolean val); //default is true
|
||||
|
||||
//Descendants will walk the full tree of windows, NOT just one level of children
|
||||
System::Int32 countDescendantWindows();
|
||||
@@ -22,11 +23,11 @@ public:
|
||||
array<System::String ^> ^ enumChildrenWindowIds(System::String ^runtimeIdValue); //if runtimeIdValue is null will start at desktop
|
||||
array<System::String ^> ^ enumDescendantWindowIds(System::String ^runtimeIdValue); //if runtimeIdValue is null will start at desktop
|
||||
array<System::String ^> ^ enumDescendantWindowIds(System::Int32 processId);
|
||||
array<System::String ^> ^ EnumDescendantWindowIdsFromHandle(System::IntPtr windowHandle);
|
||||
//In all the above Enumerate methods will return a list of Runtime Ids for all related windows.
|
||||
array<System::String ^> ^ EnumDescendantWindowInfo(System::String ^runtimeIdValue, System::String ^properties);
|
||||
|
||||
array<System::String ^> ^ enumDescendantWindowInfo(System::String ^runtimeIdValue, System::String ^properties);
|
||||
|
||||
System::String ^ getRuntimeIdFromHandle(System::IntPtr windowHandle);
|
||||
System::String ^ getRuntimeIdFromPoint(System::Int32 x, System::Int32 y);
|
||||
System::String ^ getParentRuntimeId(System::String ^runtimeIdValue);
|
||||
System::String ^ getProperty(System::String ^propertyName, System::String ^runtimeIdValue);
|
||||
array<System::String ^> ^ getProperties(System::String ^runtimeIdValue);
|
||||
@@ -36,8 +37,11 @@ private:
|
||||
System::Windows::Automation::AutomationElement ^ findAutomationElementById(System::String ^runtimeIdValue);
|
||||
System::String ^ getRuntimeIdFromElement(System::Windows::Automation::AutomationElement ^element);
|
||||
array<System::String ^> ^ getRuntimeIdsFromCollection(System::Windows::Automation::AutomationElementCollection ^collection);
|
||||
System::Windows::Automation::Condition ^ getSearchConditions();
|
||||
|
||||
static System::String ^DEFAULT_FRAMEWORK = L"WPF";
|
||||
static System::Boolean ^DEFAULT_TOUCHABLE = true;
|
||||
System::String ^frameworkId;
|
||||
System::Boolean ^touchableOnly;
|
||||
};
|
||||
|
||||
|
||||
@@ -148,6 +148,7 @@ copy /Y "$(TargetPath)" "$(ProjectDir)bin\wpfbridge$(PlatformArchitecture)$(Targ
|
||||
<Reference Include="UIAutomationClient" />
|
||||
<Reference Include="UIAutomationProvider" />
|
||||
<Reference Include="UIAutomationTypes" />
|
||||
<Reference Include="WindowsBase" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Global.h" />
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -22,6 +22,16 @@ JNIEXPORT void JNICALL Java_org_synthuse_WpfBridge_setFrameworkId(JNIEnv *env, j
|
||||
env->ReleaseStringUTFChars(jpropertyValue, propertyValue); //release string
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_synthuse_WpfBridge
|
||||
* Method: setTouchableOnly
|
||||
* Signature: (Z)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_synthuse_WpfBridge_setTouchableOnly(JNIEnv *env, jobject obj, jboolean jval)
|
||||
{
|
||||
Global::WPF_AUTO->setTouchableOnly((bool)(jval == JNI_TRUE));
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_synthuse_WpfBridge
|
||||
* Method: CountDescendantWindows
|
||||
@@ -80,7 +90,8 @@ JNIEXPORT jobjectArray JNICALL Java_org_synthuse_WpfBridge_enumChildrenWindowIds
|
||||
{
|
||||
const char *runtimeIdValue = env->GetStringUTFChars(jruntimeIdValue, 0);//convert string
|
||||
array<System::String ^> ^mchildrenIds = Global::WPF_AUTO->enumChildrenWindowIds(marshal_as<String ^>(runtimeIdValue));
|
||||
|
||||
if (mchildrenIds == nullptr)
|
||||
return NULL;
|
||||
//create result object array to the same size as the managed children Ids string array
|
||||
jclass stringClass = env->FindClass("java/lang/String");
|
||||
jobjectArray results = env->NewObjectArray(mchildrenIds->Length, stringClass, 0);
|
||||
@@ -107,7 +118,8 @@ JNIEXPORT jobjectArray JNICALL Java_org_synthuse_WpfBridge_enumDescendantWindowI
|
||||
{
|
||||
const char *runtimeIdValue = env->GetStringUTFChars(jruntimeIdValue, 0);//convert string
|
||||
array<System::String ^> ^mchildrenIds = Global::WPF_AUTO->enumDescendantWindowIds(marshal_as<String ^>(runtimeIdValue));
|
||||
|
||||
if (mchildrenIds == nullptr)
|
||||
return NULL;
|
||||
//create result object array to the same size as the managed children Ids string array
|
||||
jclass stringClass = env->FindClass("java/lang/String");
|
||||
jobjectArray results = env->NewObjectArray(mchildrenIds->Length, stringClass, 0);
|
||||
@@ -133,7 +145,8 @@ JNIEXPORT jobjectArray JNICALL Java_org_synthuse_WpfBridge_enumDescendantWindowI
|
||||
JNIEXPORT jobjectArray JNICALL Java_org_synthuse_WpfBridge_enumDescendantWindowIds__J(JNIEnv *env, jobject obj, jlong jprocessId)
|
||||
{
|
||||
array<System::String ^> ^mchildrenIds = Global::WPF_AUTO->enumDescendantWindowIds((System::Int32)jprocessId);
|
||||
|
||||
if (mchildrenIds == nullptr)
|
||||
return NULL;
|
||||
//create result object array to the same size as the managed children Ids string array
|
||||
jclass stringClass = env->FindClass("java/lang/String");
|
||||
jobjectArray results = env->NewObjectArray(mchildrenIds->Length, stringClass, 0);
|
||||
@@ -148,22 +161,17 @@ JNIEXPORT jobjectArray JNICALL Java_org_synthuse_WpfBridge_enumDescendantWindowI
|
||||
|
||||
/*
|
||||
* Class: org_synthuse_WpfBridge
|
||||
* Method: EnumDescendantWindowIdsFromHandle
|
||||
* Signature: (J)[Ljava/lang/String;
|
||||
* Method: getRuntimeIdFromHandle
|
||||
* Signature: (J)Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jobjectArray JNICALL Java_org_synthuse_WpfBridge_enumDescendantWindowIdsFromHandle(JNIEnv *env, jobject obj, jlong jwindowHandle)
|
||||
JNIEXPORT jstring JNICALL Java_org_synthuse_WpfBridge_getRuntimeIdFromHandle(JNIEnv *env, jobject obj, jlong jwindowHandle)
|
||||
{
|
||||
array<System::String ^> ^mchildrenIds = Global::WPF_AUTO->EnumDescendantWindowIdsFromHandle(System::IntPtr(jwindowHandle));
|
||||
|
||||
//create result object array to the same size as the managed children Ids string array
|
||||
jclass stringClass = env->FindClass("java/lang/String");
|
||||
jobjectArray results = env->NewObjectArray(mchildrenIds->Length, stringClass, 0);
|
||||
System::String ^mrunId = Global::WPF_AUTO->getRuntimeIdFromHandle(System::IntPtr(jwindowHandle));
|
||||
if (mrunId == nullptr)
|
||||
return NULL;
|
||||
marshal_context context; //lets you marshal managed classes to unmanaged types
|
||||
for(int i = 0 ; i < mchildrenIds->Length ; i++)
|
||||
{
|
||||
env->SetObjectArrayElement(results, i, env->NewStringUTF(context.marshal_as<const char *>(mchildrenIds[i])));
|
||||
}
|
||||
return results;
|
||||
jstring result = env->NewStringUTF(context.marshal_as<const char *>(mrunId));
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -175,7 +183,9 @@ JNIEXPORT jobjectArray JNICALL Java_org_synthuse_WpfBridge_enumDescendantWindowI
|
||||
{
|
||||
const char *runtimeIdValue = env->GetStringUTFChars(jruntimeIdValue, 0);//convert string
|
||||
const char *properties = env->GetStringUTFChars(jproperties, 0);//convert string
|
||||
array<System::String ^> ^mwinInfo = Global::WPF_AUTO->EnumDescendantWindowInfo(marshal_as<String ^>(runtimeIdValue), marshal_as<String ^>(properties));
|
||||
array<System::String ^> ^mwinInfo = Global::WPF_AUTO->enumDescendantWindowInfo(marshal_as<String ^>(runtimeIdValue), marshal_as<String ^>(properties));
|
||||
if (mwinInfo == nullptr)
|
||||
return NULL;
|
||||
//create result object array to the same size as the managed window info string array
|
||||
jclass stringClass = env->FindClass("java/lang/String");
|
||||
jobjectArray results = env->NewObjectArray(mwinInfo->Length, stringClass, 0);
|
||||
@@ -190,6 +200,21 @@ JNIEXPORT jobjectArray JNICALL Java_org_synthuse_WpfBridge_enumDescendantWindowI
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Class: org_synthuse_WpfBridge
|
||||
* Method: getRuntimeIdFromPoint
|
||||
* Signature: (II)Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL Java_org_synthuse_WpfBridge_getRuntimeIdFromPoint(JNIEnv *env, jobject obj, jint x, jint y)
|
||||
{
|
||||
System::String ^mresult = Global::WPF_AUTO->getRuntimeIdFromPoint(x, y);
|
||||
if (mresult == nullptr)
|
||||
return NULL;
|
||||
marshal_context context; //lets you marshal managed classes to unmanaged types
|
||||
jstring result = env->NewStringUTF(context.marshal_as<const char *>(mresult));
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: org_synthuse_WpfBridge
|
||||
* Method: getParentRuntimeId
|
||||
@@ -199,6 +224,8 @@ JNIEXPORT jstring JNICALL Java_org_synthuse_WpfBridge_getParentRuntimeId(JNIEnv
|
||||
{
|
||||
const char *runtimeIdValue = env->GetStringUTFChars(jruntimeIdValue, 0);//convert string
|
||||
System::String ^mresult = Global::WPF_AUTO->getParentRuntimeId(marshal_as<String ^>(runtimeIdValue));
|
||||
if (mresult == nullptr)
|
||||
return NULL;
|
||||
marshal_context context; //lets you marshal managed classes to unmanaged types
|
||||
jstring result = env->NewStringUTF(context.marshal_as<const char *>(mresult));
|
||||
env->ReleaseStringUTFChars(jruntimeIdValue, runtimeIdValue); //release string
|
||||
@@ -215,6 +242,8 @@ JNIEXPORT jstring JNICALL Java_org_synthuse_WpfBridge_getProperty(JNIEnv *env, j
|
||||
const char *runtimeIdValue = env->GetStringUTFChars(jruntimeIdValue, 0);//convert string
|
||||
const char *propertyName = env->GetStringUTFChars(jpropertyName, 0);//convert string
|
||||
System::String ^mresult = Global::WPF_AUTO->getProperty(marshal_as<String ^>(propertyName), marshal_as<String ^>(runtimeIdValue));
|
||||
if (mresult == nullptr)
|
||||
return NULL;
|
||||
marshal_context context; //lets you marshal managed classes to unmanaged types
|
||||
jstring result = env->NewStringUTF(context.marshal_as<const char *>(mresult));
|
||||
env->ReleaseStringUTFChars(jpropertyName, propertyName); //release string
|
||||
@@ -232,7 +261,8 @@ JNIEXPORT jobjectArray JNICALL Java_org_synthuse_WpfBridge_getProperties(JNIEnv
|
||||
{
|
||||
const char *runtimeIdValue = env->GetStringUTFChars(jruntimeIdValue, 0);//convert string
|
||||
array<System::String ^> ^mprops = Global::WPF_AUTO->getProperties(marshal_as<String ^>(runtimeIdValue));
|
||||
|
||||
if (mprops == nullptr)
|
||||
return NULL;
|
||||
//create result object array to the same size as the managed children Ids string array
|
||||
jclass stringClass = env->FindClass("java/lang/String");
|
||||
jobjectArray results = env->NewObjectArray(mprops->Length, stringClass, 0);
|
||||
@@ -255,7 +285,8 @@ JNIEXPORT jobjectArray JNICALL Java_org_synthuse_WpfBridge_getPropertiesAndValue
|
||||
{
|
||||
const char *runtimeIdValue = env->GetStringUTFChars(jruntimeIdValue, 0);//convert string
|
||||
array<System::String ^> ^mprops = Global::WPF_AUTO->getPropertiesAndValues(marshal_as<String ^>(runtimeIdValue));
|
||||
|
||||
if (mprops == nullptr)
|
||||
return NULL;
|
||||
//create result object array to the same size as the managed children Ids string array
|
||||
jclass stringClass = env->FindClass("java/lang/String");
|
||||
jobjectArray results = env->NewObjectArray(mprops->Length, stringClass, 0);
|
||||
|
||||
@@ -15,6 +15,14 @@ extern "C" {
|
||||
JNIEXPORT void JNICALL Java_org_synthuse_WpfBridge_setFrameworkId
|
||||
(JNIEnv *, jobject, jstring);
|
||||
|
||||
/*
|
||||
* Class: org_synthuse_WpfBridge
|
||||
* Method: setTouchableOnly
|
||||
* Signature: (Z)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_synthuse_WpfBridge_setTouchableOnly
|
||||
(JNIEnv *, jobject, jboolean);
|
||||
|
||||
/*
|
||||
* Class: org_synthuse_WpfBridge
|
||||
* Method: countDescendantWindows
|
||||
@@ -71,14 +79,6 @@ JNIEXPORT jobjectArray JNICALL Java_org_synthuse_WpfBridge_enumDescendantWindowI
|
||||
JNIEXPORT jobjectArray JNICALL Java_org_synthuse_WpfBridge_enumDescendantWindowIds__J
|
||||
(JNIEnv *, jobject, jlong);
|
||||
|
||||
/*
|
||||
* Class: org_synthuse_WpfBridge
|
||||
* Method: enumDescendantWindowIdsFromHandle
|
||||
* Signature: (J)[Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jobjectArray JNICALL Java_org_synthuse_WpfBridge_enumDescendantWindowIdsFromHandle
|
||||
(JNIEnv *, jobject, jlong);
|
||||
|
||||
/*
|
||||
* Class: org_synthuse_WpfBridge
|
||||
* Method: enumDescendantWindowInfo
|
||||
@@ -87,6 +87,22 @@ JNIEXPORT jobjectArray JNICALL Java_org_synthuse_WpfBridge_enumDescendantWindowI
|
||||
JNIEXPORT jobjectArray JNICALL Java_org_synthuse_WpfBridge_enumDescendantWindowInfo
|
||||
(JNIEnv *, jobject, jstring, jstring);
|
||||
|
||||
/*
|
||||
* Class: org_synthuse_WpfBridge
|
||||
* Method: getRuntimeIdFromHandle
|
||||
* Signature: (J)Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL Java_org_synthuse_WpfBridge_getRuntimeIdFromHandle
|
||||
(JNIEnv *, jobject, jlong);
|
||||
|
||||
/*
|
||||
* Class: org_synthuse_WpfBridge
|
||||
* Method: getRuntimeIdFromPoint
|
||||
* Signature: (II)Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL Java_org_synthuse_WpfBridge_getRuntimeIdFromPoint
|
||||
(JNIEnv *, jobject, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: org_synthuse_WpfBridge
|
||||
* Method: getParentRuntimeId
|
||||
|
||||
Reference in New Issue
Block a user