ext/UiaDll/UiaDll/ElementMethods.cpp in uia-0.0.6.1 vs ext/UiaDll/UiaDll/ElementMethods.cpp in uia-0.0.7
- old
+ new
@@ -95,36 +95,40 @@
}
return NULL;
}
- __declspec(dllexport) ElementsPtr Root_Children(char* errorInfo, const int errorInfoLength) {
+ __declspec(dllexport) int Root_Children(ElementInformation** children, char* errorInfo, const int errorInfoLength) {
try {
- return new Elements(Element::Windows);
+ auto windows = Element::Windows;
+ *children = ElementInformation::From(windows);
+ return windows->Length;
} catch(Exception^ e) {
StringHelper::CopyToUnmanagedString(e->Message, errorInfo, errorInfoLength);
- return NULL;
+ return 0;
}
}
- __declspec(dllexport) ElementsPtr Element_Children(ElementInformationPtr parentElement, char* errorInfo, const int errorLength) {
+ __declspec(dllexport) int Element_Children(ElementInformationPtr parentElement, ElementInformation** children, char* errorInfo, const int errorLength) {
try {
- return new Elements(Find(parentElement)->Children);
+ auto elements = Find(parentElement)->Children;
+ *children = ElementInformation::From(elements);
+ return elements->Length;
} catch(Exception^ error) {
StringHelper::CopyToUnmanagedString(error->Message, errorInfo, errorLength);
+ return 0;
}
-
- return NULL;
}
- __declspec(dllexport) ElementsPtr Element_Descendants(ElementInformationPtr parentElement, char* errorInfo, const int errorLength) {
+ __declspec(dllexport) int Element_Descendants(ElementInformationPtr parentElement, ElementInformation** descendants, char* errorInfo, const int errorLength) {
try {
- return new Elements(Find(parentElement)->Descendants);
+ auto elements = Find(parentElement)->Descendants;
+ *descendants = ElementInformation::From(elements);
+ return elements->Length;
} catch(Exception^ error) {
StringHelper::CopyToUnmanagedString(error->Message, errorInfo, errorLength);
+ return 0;
}
-
- return NULL;
}
__declspec(dllexport) void Element_Click(ElementInformationPtr element, char* errorInfo, const int errorLength) {
try {
Find(element)->MouseClick();
\ No newline at end of file