rautomation 2.0.1-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (202) hide show
  1. checksums.yaml +7 -0
  2. data/.document +5 -0
  3. data/.gitignore +41 -0
  4. data/.rspec +2 -0
  5. data/.yardopts +8 -0
  6. data/CHANGES.md +276 -0
  7. data/Gemfile +3 -0
  8. data/LICENSE +20 -0
  9. data/README.md +142 -0
  10. data/Rakefile +73 -0
  11. data/ext/AutoItX/AutoItX.chm +0 -0
  12. data/ext/AutoItX/AutoItX3.dll +0 -0
  13. data/ext/IAccessibleDLL/IAccessibleDLL/IAccessibleDLL.cpp +30 -0
  14. data/ext/IAccessibleDLL/IAccessibleDLL/IAccessibleDLL.vcxproj +179 -0
  15. data/ext/IAccessibleDLL/IAccessibleDLL/IAccessibleDLL.vcxproj.filters +42 -0
  16. data/ext/IAccessibleDLL/IAccessibleDLL/IAccessibleDLL.vcxproj.user +3 -0
  17. data/ext/IAccessibleDLL/IAccessibleDLL/ReadMe.txt +48 -0
  18. data/ext/IAccessibleDLL/IAccessibleDLL/dllmain.cpp +19 -0
  19. data/ext/IAccessibleDLL/IAccessibleDLL/stdafx.cpp +8 -0
  20. data/ext/IAccessibleDLL/IAccessibleDLL/stdafx.h +22 -0
  21. data/ext/IAccessibleDLL/IAccessibleDLL/table_support.cpp +282 -0
  22. data/ext/IAccessibleDLL/IAccessibleDLL/targetver.h +8 -0
  23. data/ext/IAccessibleDLL/IAccessibleDLL.sln +31 -0
  24. data/ext/IAccessibleDLL/IAccessibleDLL.suo +0 -0
  25. data/ext/IAccessibleDLL/Release/IAccessibleDLL.dll +0 -0
  26. data/ext/UiaDll/RAutomation.UIA/Controls/Clicker.cs +63 -0
  27. data/ext/UiaDll/RAutomation.UIA/Controls/SelectList.cs +116 -0
  28. data/ext/UiaDll/RAutomation.UIA/Controls/Spinner.cs +46 -0
  29. data/ext/UiaDll/RAutomation.UIA/Controls/TabControl.cs +54 -0
  30. data/ext/UiaDll/RAutomation.UIA/Controls/TableControl.cs +132 -0
  31. data/ext/UiaDll/RAutomation.UIA/Controls/TextControl.cs +50 -0
  32. data/ext/UiaDll/RAutomation.UIA/Expander.cs +59 -0
  33. data/ext/UiaDll/RAutomation.UIA/Extensions/Element.cs +166 -0
  34. data/ext/UiaDll/RAutomation.UIA/Extensions/Enumerable.cs +76 -0
  35. data/ext/UiaDll/RAutomation.UIA/Extensions/Property.cs +27 -0
  36. data/ext/UiaDll/RAutomation.UIA/Properties/AssemblyInfo.cs +36 -0
  37. data/ext/UiaDll/RAutomation.UIA/Properties/AutomationProperties.cs +18 -0
  38. data/ext/UiaDll/RAutomation.UIA/RAutomation.UIA.csproj +77 -0
  39. data/ext/UiaDll/Release/RAutomation.UIA.dll +0 -0
  40. data/ext/UiaDll/Release/UiaDll.dll +0 -0
  41. data/ext/UiaDll/UiaDll/ArrayHelper.cpp +14 -0
  42. data/ext/UiaDll/UiaDll/ArrayHelper.h +7 -0
  43. data/ext/UiaDll/UiaDll/AssemblyInfo.cpp +40 -0
  44. data/ext/UiaDll/UiaDll/ControlMethods.cpp +16 -0
  45. data/ext/UiaDll/UiaDll/DynamicAssemblyResolver.cpp +24 -0
  46. data/ext/UiaDll/UiaDll/DynamicAssemblyResolver.h +16 -0
  47. data/ext/UiaDll/UiaDll/Locator.cpp +93 -0
  48. data/ext/UiaDll/UiaDll/Locator.h +55 -0
  49. data/ext/UiaDll/UiaDll/MenuItemSelector.cpp +75 -0
  50. data/ext/UiaDll/UiaDll/MenuItemSelector.h +24 -0
  51. data/ext/UiaDll/UiaDll/MenuMethods.cpp +62 -0
  52. data/ext/UiaDll/UiaDll/ReadMe.txt +38 -0
  53. data/ext/UiaDll/UiaDll/SelectListMethods.cpp +84 -0
  54. data/ext/UiaDll/UiaDll/SpinnerMethods.cpp +61 -0
  55. data/ext/UiaDll/UiaDll/StringHelper.cpp +57 -0
  56. data/ext/UiaDll/UiaDll/StringHelper.h +15 -0
  57. data/ext/UiaDll/UiaDll/StringMethods.cpp +8 -0
  58. data/ext/UiaDll/UiaDll/TabControlMethods.cpp +40 -0
  59. data/ext/UiaDll/UiaDll/TableMethods.cpp +108 -0
  60. data/ext/UiaDll/UiaDll/TextMethods.cpp +25 -0
  61. data/ext/UiaDll/UiaDll/ToggleStateHelper.h +10 -0
  62. data/ext/UiaDll/UiaDll/UiaDll.cpp +216 -0
  63. data/ext/UiaDll/UiaDll/UiaDll.h +13 -0
  64. data/ext/UiaDll/UiaDll/UiaDll.vcxproj +167 -0
  65. data/ext/UiaDll/UiaDll/UiaDll.vcxproj.filters +110 -0
  66. data/ext/UiaDll/UiaDll/app.ico +0 -0
  67. data/ext/UiaDll/UiaDll/app.rc +0 -0
  68. data/ext/UiaDll/UiaDll/dllmain.cpp +1 -0
  69. data/ext/UiaDll/UiaDll/resource.h +3 -0
  70. data/ext/UiaDll/UiaDll/stdafx.cpp +5 -0
  71. data/ext/UiaDll/UiaDll/stdafx.h +41 -0
  72. data/ext/UiaDll/UiaDll/targetver.h +8 -0
  73. data/ext/UiaDll/UiaDll.sln +57 -0
  74. data/ext/WindowsForms/.nuget/NuGet.Config +6 -0
  75. data/ext/WindowsForms/.nuget/NuGet.exe +0 -0
  76. data/ext/WindowsForms/.nuget/NuGet.targets +136 -0
  77. data/ext/WindowsForms/Release/FizzWare.NBuilder.dll +0 -0
  78. data/ext/WindowsForms/Release/UIA.Extensions.dll +0 -0
  79. data/ext/WindowsForms/Release/WindowsForms.exe +0 -0
  80. data/ext/WindowsForms/WindowsForms/AboutBox.Designer.cs +168 -0
  81. data/ext/WindowsForms/WindowsForms/AboutBox.cs +103 -0
  82. data/ext/WindowsForms/WindowsForms/AboutBox.resx +123 -0
  83. data/ext/WindowsForms/WindowsForms/DataEntryForm.Designer.cs +218 -0
  84. data/ext/WindowsForms/WindowsForms/DataEntryForm.cs +52 -0
  85. data/ext/WindowsForms/WindowsForms/DataEntryForm.resx +120 -0
  86. data/ext/WindowsForms/WindowsForms/DataGridView.Designer.cs +77 -0
  87. data/ext/WindowsForms/WindowsForms/DataGridView.cs +43 -0
  88. data/ext/WindowsForms/WindowsForms/DataGridView.resx +120 -0
  89. data/ext/WindowsForms/WindowsForms/FizzWare.NBuilder.dll +0 -0
  90. data/ext/WindowsForms/WindowsForms/MainFormWindow.Designer.cs +527 -0
  91. data/ext/WindowsForms/WindowsForms/MainFormWindow.cs +109 -0
  92. data/ext/WindowsForms/WindowsForms/MainFormWindow.resx +126 -0
  93. data/ext/WindowsForms/WindowsForms/PersonForm.Designer.cs +119 -0
  94. data/ext/WindowsForms/WindowsForms/PersonForm.cs +34 -0
  95. data/ext/WindowsForms/WindowsForms/PersonForm.resx +120 -0
  96. data/ext/WindowsForms/WindowsForms/Program.cs +21 -0
  97. data/ext/WindowsForms/WindowsForms/Properties/AssemblyInfo.cs +36 -0
  98. data/ext/WindowsForms/WindowsForms/Properties/Resources.Designer.cs +71 -0
  99. data/ext/WindowsForms/WindowsForms/Properties/Resources.resx +117 -0
  100. data/ext/WindowsForms/WindowsForms/Properties/Settings.Designer.cs +30 -0
  101. data/ext/WindowsForms/WindowsForms/Properties/Settings.settings +7 -0
  102. data/ext/WindowsForms/WindowsForms/SimpleElementsForm.Designer.cs +93 -0
  103. data/ext/WindowsForms/WindowsForms/SimpleElementsForm.cs +19 -0
  104. data/ext/WindowsForms/WindowsForms/SimpleElementsForm.resx +120 -0
  105. data/ext/WindowsForms/WindowsForms/UIA.Extensions.dll +0 -0
  106. data/ext/WindowsForms/WindowsForms/ValueMonthCalendar.cs +28 -0
  107. data/ext/WindowsForms/WindowsForms/WindowsForms.csproj +166 -0
  108. data/ext/WindowsForms/WindowsForms/packages.config +4 -0
  109. data/ext/WindowsForms/WindowsForms.sln +46 -0
  110. data/lib/rautomation/adapter/autoit/button.rb +59 -0
  111. data/lib/rautomation/adapter/autoit/locators.rb +22 -0
  112. data/lib/rautomation/adapter/autoit/mouse.rb +38 -0
  113. data/lib/rautomation/adapter/autoit/text_field.rb +70 -0
  114. data/lib/rautomation/adapter/autoit/window.rb +197 -0
  115. data/lib/rautomation/adapter/autoit.rb +8 -0
  116. data/lib/rautomation/adapter/helper.rb +64 -0
  117. data/lib/rautomation/adapter/ms_uia/button.rb +21 -0
  118. data/lib/rautomation/adapter/ms_uia/button_helper.rb +19 -0
  119. data/lib/rautomation/adapter/ms_uia/checkbox.rb +23 -0
  120. data/lib/rautomation/adapter/ms_uia/constants.rb +111 -0
  121. data/lib/rautomation/adapter/ms_uia/control.rb +134 -0
  122. data/lib/rautomation/adapter/ms_uia/functions.rb +279 -0
  123. data/lib/rautomation/adapter/ms_uia/keys.rb +121 -0
  124. data/lib/rautomation/adapter/ms_uia/keystroke_converter.rb +122 -0
  125. data/lib/rautomation/adapter/ms_uia/label.rb +18 -0
  126. data/lib/rautomation/adapter/ms_uia/list_box.rb +46 -0
  127. data/lib/rautomation/adapter/ms_uia/list_item.rb +22 -0
  128. data/lib/rautomation/adapter/ms_uia/locators.rb +23 -0
  129. data/lib/rautomation/adapter/ms_uia/menu.rb +36 -0
  130. data/lib/rautomation/adapter/ms_uia/radio.rb +23 -0
  131. data/lib/rautomation/adapter/ms_uia/select_list.rb +85 -0
  132. data/lib/rautomation/adapter/ms_uia/spinner.rb +31 -0
  133. data/lib/rautomation/adapter/ms_uia/tab_control.rb +46 -0
  134. data/lib/rautomation/adapter/ms_uia/table.rb +140 -0
  135. data/lib/rautomation/adapter/ms_uia/text_field.rb +39 -0
  136. data/lib/rautomation/adapter/ms_uia/uia_dll.rb +428 -0
  137. data/lib/rautomation/adapter/ms_uia/value_control.rb +21 -0
  138. data/lib/rautomation/adapter/ms_uia/window.rb +289 -0
  139. data/lib/rautomation/adapter/ms_uia.rb +27 -0
  140. data/lib/rautomation/adapter/win_32/button.rb +14 -0
  141. data/lib/rautomation/adapter/win_32/button_helper.rb +24 -0
  142. data/lib/rautomation/adapter/win_32/checkbox.rb +14 -0
  143. data/lib/rautomation/adapter/win_32/constants.rb +73 -0
  144. data/lib/rautomation/adapter/win_32/control.rb +86 -0
  145. data/lib/rautomation/adapter/win_32/functions.rb +336 -0
  146. data/lib/rautomation/adapter/win_32/keys.rb +146 -0
  147. data/lib/rautomation/adapter/win_32/label.rb +10 -0
  148. data/lib/rautomation/adapter/win_32/list_box.rb +40 -0
  149. data/lib/rautomation/adapter/win_32/locators.rb +22 -0
  150. data/lib/rautomation/adapter/win_32/mouse.rb +59 -0
  151. data/lib/rautomation/adapter/win_32/password_field.rb +15 -0
  152. data/lib/rautomation/adapter/win_32/radio.rb +11 -0
  153. data/lib/rautomation/adapter/win_32/select_list.rb +97 -0
  154. data/lib/rautomation/adapter/win_32/table.rb +25 -0
  155. data/lib/rautomation/adapter/win_32/text_field.rb +52 -0
  156. data/lib/rautomation/adapter/win_32/window.rb +277 -0
  157. data/lib/rautomation/adapter/win_32.rb +23 -0
  158. data/lib/rautomation/button.rb +55 -0
  159. data/lib/rautomation/element_collections.rb +55 -0
  160. data/lib/rautomation/platform.rb +15 -0
  161. data/lib/rautomation/text_field.rb +60 -0
  162. data/lib/rautomation/version.rb +3 -0
  163. data/lib/rautomation/wait_helper.rb +23 -0
  164. data/lib/rautomation/window.rb +248 -0
  165. data/lib/rautomation.rb +8 -0
  166. data/rautomation.gemspec +52 -0
  167. data/spec/adapter/autoit/mouse_spec.rb +53 -0
  168. data/spec/adapter/autoit/window_spec.rb +17 -0
  169. data/spec/adapter/ms_uia/button_spec.rb +39 -0
  170. data/spec/adapter/ms_uia/checkbox_spec.rb +55 -0
  171. data/spec/adapter/ms_uia/control_spec.rb +88 -0
  172. data/spec/adapter/ms_uia/functions_spec.rb +39 -0
  173. data/spec/adapter/ms_uia/keystroke_converter_spec.rb +48 -0
  174. data/spec/adapter/ms_uia/label_spec.rb +18 -0
  175. data/spec/adapter/ms_uia/list_item_spec.rb +14 -0
  176. data/spec/adapter/ms_uia/listbox_spec.rb +73 -0
  177. data/spec/adapter/ms_uia/radio_spec.rb +39 -0
  178. data/spec/adapter/ms_uia/select_list_spec.rb +118 -0
  179. data/spec/adapter/ms_uia/spinner_spec.rb +44 -0
  180. data/spec/adapter/ms_uia/tab_control_spec.rb +53 -0
  181. data/spec/adapter/ms_uia/table_spec.rb +197 -0
  182. data/spec/adapter/ms_uia/text_field_spec.rb +43 -0
  183. data/spec/adapter/ms_uia/value_control_spec.rb +11 -0
  184. data/spec/adapter/ms_uia/window_spec.rb +81 -0
  185. data/spec/adapter/win_32/button_spec.rb +31 -0
  186. data/spec/adapter/win_32/checkbox_spec.rb +46 -0
  187. data/spec/adapter/win_32/label_spec.rb +13 -0
  188. data/spec/adapter/win_32/listbox_spec.rb +41 -0
  189. data/spec/adapter/win_32/mouse_spec.rb +49 -0
  190. data/spec/adapter/win_32/radio_spec.rb +33 -0
  191. data/spec/adapter/win_32/select_list_spec.rb +65 -0
  192. data/spec/adapter/win_32/table_spec.rb +27 -0
  193. data/spec/adapter/win_32/text_field_spec.rb +24 -0
  194. data/spec/adapter/win_32/window_spec.rb +61 -0
  195. data/spec/button_spec.rb +67 -0
  196. data/spec/buttons_spec.rb +21 -0
  197. data/spec/spec_helper.rb +128 -0
  198. data/spec/text_field_spec.rb +64 -0
  199. data/spec/text_fields_spec.rb +22 -0
  200. data/spec/window_spec.rb +150 -0
  201. data/spec/windows_spec.rb +76 -0
  202. metadata +369 -0
@@ -0,0 +1,38 @@
1
+ ========================================================================
2
+ DYNAMIC LINK LIBRARY : UiaDll Project Overview
3
+ ========================================================================
4
+
5
+ AppWizard has created this UiaDll DLL for you.
6
+
7
+ This file contains a summary of what you will find in each of the files that
8
+ make up your UiaDll application.
9
+
10
+ UiaDll.vcxproj
11
+ This is the main project file for VC++ projects generated using an Application Wizard.
12
+ It contains information about the version of Visual C++ that generated the file, and
13
+ information about the platforms, configurations, and project features selected with the
14
+ Application Wizard.
15
+
16
+ UiaDll.vcxproj.filters
17
+ This is the filters file for VC++ projects generated using an Application Wizard.
18
+ It contains information about the association between the files in your project
19
+ and the filters. This association is used in the IDE to show grouping of files with
20
+ similar extensions under a specific node (for e.g. ".cpp" files are associated with the
21
+ "Source Files" filter).
22
+
23
+ UiaDll.cpp
24
+ This is the main DLL source file.
25
+
26
+ UiaDll.h
27
+ This file contains a class declaration.
28
+
29
+ AssemblyInfo.cpp
30
+ Contains custom attributes for modifying assembly metadata.
31
+
32
+ /////////////////////////////////////////////////////////////////////////////
33
+ Other notes:
34
+
35
+ AppWizard uses "TODO:" to indicate parts of the source code you
36
+ should add to or customize.
37
+
38
+ /////////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,84 @@
1
+ #include "stdafx.h"
2
+ #include "Locator.h"
3
+ #include "StringHelper.h"
4
+
5
+ using namespace RAutomation::UIA::Controls;
6
+
7
+ extern "C" {
8
+
9
+ __declspec ( dllexport ) int SelectList_Count(const FindInformation& findInformation) {
10
+ auto selectList = gcnew SelectList(Locator::FindFor(findInformation));
11
+ return selectList->Count;
12
+ }
13
+
14
+ __declspec ( dllexport ) int SelectList_Options(const FindInformation& findInformation, const char* options[]) {
15
+ auto selectList = gcnew SelectList(Locator::FindFor(findInformation));
16
+ return StringHelper::Copy(selectList->Options, options);
17
+ }
18
+
19
+ __declspec ( dllexport ) int SelectList_SelectedIndex(const FindInformation& findInformation) {
20
+ auto selectList = gcnew SelectList(Locator::FindFor(findInformation));
21
+ return selectList->SelectedIndex;
22
+ }
23
+
24
+ __declspec ( dllexport ) void SelectList_Selection(const FindInformation& findInformation, char* selection, const int selectionLength) {
25
+ auto selectList = gcnew SelectList(Locator::FindFor(findInformation));
26
+ StringHelper::CopyToUnmanagedString(selectList->Selection, selection, selectionLength);
27
+ }
28
+
29
+ __declspec ( dllexport ) int SelectList_Selections(const FindInformation& findInformation, const char* selections[]) {
30
+ auto selectList = gcnew SelectList(Locator::FindFor(findInformation));
31
+ return StringHelper::Copy(selectList->Selections, selections);
32
+ }
33
+
34
+ __declspec ( dllexport ) bool SelectList_ValueAt(const FindInformation& findInformation, const int whichItem, char* comboValue, const int comboValueSize) {
35
+ try {
36
+ auto selectList = gcnew SelectList(Locator::FindFor(findInformation));
37
+ StringHelper::CopyToUnmanagedString(selectList->At(whichItem), comboValue, comboValueSize);
38
+ return true;
39
+ } catch(Exception^ e) {
40
+ Console::WriteLine(e);
41
+ return false;
42
+ }
43
+ }
44
+
45
+ __declspec ( dllexport ) void SelectList_RemoveIndex(const FindInformation& findInformation, const int whichItem, char* errorInfo, const int errorInfoLength) {
46
+ try {
47
+ auto selectList = gcnew SelectList(Locator::FindFor(findInformation));
48
+ selectList->Remove(whichItem);
49
+ } catch(Exception^ e) {
50
+ StringHelper::Write(e, errorInfo, errorInfoLength);
51
+ }
52
+ }
53
+
54
+ __declspec ( dllexport ) void SelectList_RemoveValue(const FindInformation& findInformation, const char* whichItem, char* errorInfo, const int errorInfoLength) {
55
+ try {
56
+ auto selectList = gcnew SelectList(Locator::FindFor(findInformation));
57
+ selectList->Remove(gcnew String(whichItem));
58
+ } catch(Exception^ e) {
59
+ StringHelper::Write(e, errorInfo, errorInfoLength);
60
+ }
61
+ }
62
+
63
+ __declspec ( dllexport ) bool SelectList_SelectIndex(const FindInformation& findInformation, const int whichItem) {
64
+ try {
65
+ auto selectList = gcnew SelectList(Locator::FindFor(findInformation));
66
+ selectList->SelectedIndex = whichItem;
67
+ return true;
68
+ } catch(Exception^ e) {
69
+ Console::WriteLine(e);
70
+ return false;
71
+ }
72
+ }
73
+
74
+ __declspec ( dllexport ) int SelectList_SelectValue(const FindInformation& findInformation, char *pValue) {
75
+ try {
76
+ auto selectList = gcnew SelectList(Locator::FindFor(findInformation));
77
+ selectList->Selection = gcnew String(pValue);
78
+ return true;
79
+ } catch(Exception^ e) {
80
+ Console::WriteLine(e);
81
+ return false;
82
+ }
83
+ }
84
+ }
@@ -0,0 +1,61 @@
1
+ #include "stdafx.h"
2
+ #include "Locator.h"
3
+ #include "StringHelper.h"
4
+
5
+ using namespace RAutomation::UIA::Controls;
6
+
7
+ extern "C" {
8
+ __declspec (dllexport) double Spinner_GetValue(const FindInformation& findInformation, char* errorInfo, const int errorInfoLength) {
9
+ try {
10
+ auto spinner = gcnew Spinner(Locator::FindFor(findInformation));
11
+ return spinner->Value;
12
+ } catch(Exception^ e) {
13
+ StringHelper::CopyToUnmanagedString(e->Message, errorInfo, errorInfoLength);
14
+ }
15
+ }
16
+
17
+ __declspec (dllexport) void Spinner_SetValue(const FindInformation& findInformation, double theValue, char* errorInfo, const int errorInfoLength) {
18
+ try {
19
+ auto spinner = gcnew Spinner(Locator::FindFor(findInformation));
20
+ spinner->Value = theValue;
21
+ } catch(Exception^ e) {
22
+ StringHelper::CopyToUnmanagedString(e->Message, errorInfo, errorInfoLength);
23
+ }
24
+ }
25
+
26
+ __declspec (dllexport) double Spinner_Minimum(const FindInformation& findInformation, char* errorInfo, const int errorInfoLength) {
27
+ try {
28
+ auto spinner = gcnew Spinner(Locator::FindFor(findInformation));
29
+ return spinner->Minimum;
30
+ } catch(Exception^ e) {
31
+ StringHelper::CopyToUnmanagedString(e->Message, errorInfo, errorInfoLength);
32
+ }
33
+ }
34
+
35
+ __declspec (dllexport) double Spinner_Maximum(const FindInformation& findInformation, char* errorInfo, const int errorInfoLength) {
36
+ try {
37
+ auto spinner = gcnew Spinner(Locator::FindFor(findInformation));
38
+ return spinner->Maximum;
39
+ } catch(Exception^ e) {
40
+ StringHelper::CopyToUnmanagedString(e->Message, errorInfo, errorInfoLength);
41
+ }
42
+ }
43
+
44
+ __declspec (dllexport) double Spinner_Increment(const FindInformation& findInformation, char* errorInfo, const int errorInfoLength) {
45
+ try {
46
+ auto spinner = gcnew Spinner(Locator::FindFor(findInformation));
47
+ return spinner->Increment();
48
+ } catch(Exception^ e) {
49
+ StringHelper::CopyToUnmanagedString(e->Message, errorInfo, errorInfoLength);
50
+ }
51
+ }
52
+
53
+ __declspec (dllexport) double Spinner_Decrement(const FindInformation& findInformation, char* errorInfo, const int errorInfoLength) {
54
+ try {
55
+ auto spinner = gcnew Spinner(Locator::FindFor(findInformation));
56
+ return spinner->Decrement();
57
+ } catch(Exception^ e) {
58
+ StringHelper::CopyToUnmanagedString(e->Message, errorInfo, errorInfoLength);
59
+ }
60
+ }
61
+ }
@@ -0,0 +1,57 @@
1
+ #include "StdAfx.h"
2
+ #include "StringHelper.h"
3
+
4
+ void StringHelper::CopyToUnmanagedString(String^ source, char* destination, const int destinationSize)
5
+ {
6
+ auto unmanagedString = Marshal::StringToHGlobalAnsi(source);
7
+ strncpy_s(destination, destinationSize, (const char*)(void*)unmanagedString, _TRUNCATE);
8
+ Marshal::FreeHGlobal(unmanagedString);
9
+ }
10
+
11
+ void StringHelper::Write(Exception^ error, char* destination, const int destinationSize)
12
+ {
13
+ StringHelper::CopyToUnmanagedString(error->Message, destination, destinationSize);
14
+ }
15
+
16
+ char* StringHelper::UnmanagedStringFrom(String^ source)
17
+ {
18
+ const int numberOfBytes = source->Length + 1;
19
+ auto unmanagedString = new char[numberOfBytes];
20
+ CopyToUnmanagedString(source, unmanagedString, numberOfBytes);
21
+ return unmanagedString;
22
+ }
23
+
24
+ void StringHelper::FreeUp(const char* unmanagedStrings[], const int numberOfStrings)
25
+ {
26
+ for(auto whichString = 0; whichString < numberOfStrings; ++whichString) {
27
+ delete[] unmanagedStrings[whichString];
28
+ }
29
+ }
30
+
31
+ int StringHelper::Copy(array<String^>^ strings, const char* unmanagedStrings[])
32
+ {
33
+ if( NULL != unmanagedStrings ) {
34
+ auto whichItem = 0;
35
+ for each(String^ theString in strings) {
36
+ unmanagedStrings[whichItem++] = UnmanagedStringFrom(theString);
37
+ }
38
+ }
39
+
40
+ return strings->Length;
41
+ }
42
+
43
+ void StringHelper::CopyNames(AutomationElementCollection^ automationElements, const char* unmanagedStrings[])
44
+ {
45
+ auto whichItem = 0;
46
+ for each(AutomationElement^ automationElement in automationElements) {
47
+ unmanagedStrings[whichItem++] = UnmanagedStringFrom(automationElement->Current.Name);
48
+ }
49
+ }
50
+
51
+ void StringHelper::CopyClassNames(AutomationElementCollection^ automationElements, const char* unmanagedStrings[])
52
+ {
53
+ auto whichItem = 0;
54
+ for each(AutomationElement^ automationElement in automationElements) {
55
+ unmanagedStrings[whichItem++] = UnmanagedStringFrom(automationElement->Current.ClassName);
56
+ }
57
+ }
@@ -0,0 +1,15 @@
1
+ #pragma once
2
+ using namespace System::Windows::Automation;
3
+
4
+ ref class StringHelper
5
+ {
6
+ public:
7
+ static void CopyToUnmanagedString(String^ source, char* destination, const int destinationSize);
8
+ static void StringHelper::Write(Exception^ error, char* destination, const int destinationSize);
9
+ static char* UnmanagedStringFrom(String^ source);
10
+ static void FreeUp(const char* unmanagedStrings[], const int numberOfStrings);
11
+ static int Copy(array<String^>^ strings, const char* unmanagedStrings[]);
12
+ static void CopyNames(AutomationElementCollection^ automationElements, const char* unmanagedStrings[]);
13
+ static void CopyClassNames(AutomationElementCollection^ automationElements, const char* unmanagedStrings[]);
14
+ };
15
+
@@ -0,0 +1,8 @@
1
+ #include "stdafx.h"
2
+ #include "StringHelper.h"
3
+
4
+ extern "C" {
5
+ __declspec ( dllexport ) void String_CleanUp(const char* strings[], const int numberOfStrings) {
6
+ StringHelper::FreeUp(strings, numberOfStrings);
7
+ }
8
+ }
@@ -0,0 +1,40 @@
1
+ #include "stdafx.h"
2
+ #include "Locator.h"
3
+ #include "StringHelper.h"
4
+
5
+ using namespace RAutomation::UIA::Controls;
6
+
7
+ extern "C" {
8
+ __declspec(dllexport) int TabControl_Items(const FindInformation& findInformation, const char* options[]) {
9
+ auto tabControl = gcnew TabControl(Locator::FindFor(findInformation));
10
+ return StringHelper::Copy(tabControl->TabNames, options);
11
+ }
12
+
13
+ __declspec(dllexport) void TabControl_Selection(const FindInformation& findInformation, char* selection, const int selectionLength) {
14
+ auto tabControl = gcnew TabControl(Locator::FindFor(findInformation));
15
+ StringHelper::CopyToUnmanagedString(tabControl->Selection, selection, selectionLength);
16
+ }
17
+
18
+ __declspec(dllexport) void TabControl_SelectByIndex(const FindInformation& findInformation, const int index, char* errorInfo, const int errorInfoLength) {
19
+ try {
20
+ auto tabControl = gcnew TabControl(Locator::FindFor(findInformation));
21
+ return tabControl->SelectedIndex = index;
22
+ } catch(Exception^) {
23
+ _snprintf(errorInfo, errorInfoLength, "A tab with index %d was not found", index);
24
+ }
25
+ }
26
+
27
+ __declspec(dllexport) int TabControl_SelectedIndex(const FindInformation& findInformation) {
28
+ auto tabControl = gcnew TabControl(Locator::FindFor(findInformation));
29
+ return tabControl->SelectedIndex;
30
+ }
31
+
32
+ __declspec(dllexport) void TabControl_SelectByValue(const FindInformation& findInformation, const char* value, char* errorInfo, const int errorInfoLength) {
33
+ try {
34
+ auto tabControl = gcnew TabControl(Locator::FindFor(findInformation));
35
+ tabControl->Selection = gcnew String(value);
36
+ } catch(Exception^) {
37
+ _snprintf(errorInfo, errorInfoLength, "A tab with the value %s was not found", value);
38
+ }
39
+ }
40
+ }
@@ -0,0 +1,108 @@
1
+ #include "stdafx.h"
2
+ #include "Locator.h"
3
+ #include "ArrayHelper.h"
4
+ #include "StringHelper.h"
5
+
6
+ using namespace RAutomation::UIA::Controls;
7
+
8
+ extern "C" {
9
+
10
+ __declspec ( dllexport ) int Table_GetHeaders(const FindInformation& findInformation, const char* headers[]) {
11
+ auto tableControl = gcnew TableControl(Locator::FindFor(findInformation));
12
+ return StringHelper::Copy(tableControl->Headers, headers);
13
+ }
14
+
15
+ __declspec ( dllexport ) int Table_GetValues(const FindInformation& findInformation, const char* values[]) {
16
+ auto tableControl = gcnew TableControl(Locator::FindFor(findInformation));
17
+ return StringHelper::Copy(tableControl->Values, values);
18
+ }
19
+
20
+ __declspec ( dllexport ) int Table_GetSelectedIndexes(const FindInformation& findInformation, int selectedIndexes[]) {
21
+ auto tableControl = gcnew TableControl(Locator::FindFor(findInformation));
22
+ return ArrayHelper::Copy(tableControl->SelectedIndexes, selectedIndexes);
23
+ }
24
+
25
+ __declspec ( dllexport ) int Table_RowCount(const FindInformation& findInformation) {
26
+ try {
27
+ auto tableControl = gcnew TableControl(Locator::FindFor(findInformation));
28
+ return tableControl->RowCount;
29
+ } catch(Exception^ e) {
30
+ Console::WriteLine(e->ToString());
31
+ return 0;
32
+ }
33
+ }
34
+
35
+ __declspec ( dllexport ) bool Table_CoordinateIsValid(const FindInformation& findInformation, const int whichItemIndex, const int whichColumnIndex) {
36
+ try {
37
+ auto tableControl = gcnew TableControl(Locator::FindFor(findInformation));
38
+ return tableControl->Exists(whichItemIndex, whichColumnIndex);
39
+ } catch(Exception^ e) {
40
+ Console::WriteLine(e->ToString());
41
+ return false;
42
+ }
43
+ }
44
+
45
+ __declspec ( dllexport ) void Table_ValueAt(const FindInformation& findInformation, const int row, const int column, char *foundValue, const int foundValueLength) {
46
+ try {
47
+ auto tableControl = gcnew TableControl(Locator::FindFor(findInformation));
48
+ StringHelper::CopyToUnmanagedString(tableControl->ValueAt(row, column), foundValue, foundValueLength);
49
+ } catch(Exception^ e) {
50
+ Console::WriteLine(e->ToString());
51
+ }
52
+ }
53
+
54
+ __declspec ( dllexport ) void Table_SelectByIndex(const FindInformation& findInformation, const int dataItemIndex, char* errorInfo, const int errorInfoLength) {
55
+ try {
56
+ auto tableControl = gcnew TableControl(Locator::FindFor(findInformation));
57
+ tableControl->SelectedIndex = dataItemIndex;
58
+ } catch(Exception^ e) {
59
+ StringHelper::Write(e, errorInfo, errorInfoLength);
60
+ }
61
+ }
62
+
63
+ __declspec ( dllexport ) void Table_SingleSelectByIndex(const FindInformation& findInformation, const int dataItemIndex, char* errorInfo, const int errorInfoLength) {
64
+ try {
65
+ auto tableControl = gcnew TableControl(Locator::FindFor(findInformation));
66
+ tableControl->SingleSelect(dataItemIndex);
67
+ } catch(Exception^ e) {
68
+ StringHelper::Write(e, errorInfo, errorInfoLength);
69
+ }
70
+ }
71
+
72
+ __declspec ( dllexport ) void Table_RemoveRowByIndex(const FindInformation& findInformation, const int dataItemIndex, char* errorInfo, const int errorInfoLength) {
73
+ try {
74
+ auto tableControl = gcnew TableControl(Locator::FindFor(findInformation));
75
+ tableControl->Remove(dataItemIndex);
76
+ } catch(Exception^ e) {
77
+ StringHelper::Write(e, errorInfo, errorInfoLength);
78
+ }
79
+ }
80
+
81
+ __declspec ( dllexport ) void Table_RemoveRowByValue(const FindInformation& findInformation, const char* dataItemValue, char* errorInfo, const int errorInfoLength) {
82
+ try {
83
+ auto tableControl = gcnew TableControl(Locator::FindFor(findInformation));
84
+ tableControl->Remove(gcnew String(dataItemValue));
85
+ } catch(Exception^ e) {
86
+ StringHelper::Write(e, errorInfo, errorInfoLength);
87
+ }
88
+ }
89
+
90
+ __declspec ( dllexport ) bool Table_IsSelectedByIndex(const FindInformation& findInformation, const int dataItemIndex) {
91
+ try {
92
+ auto tableControl = gcnew TableControl(Locator::FindFor(findInformation));
93
+ return tableControl->IsRowSelected(dataItemIndex);
94
+ } catch(Exception^ e) {
95
+ Console::WriteLine(e->ToString());
96
+ return false;
97
+ }
98
+ }
99
+
100
+ __declspec ( dllexport ) void Table_SelectByValue(const FindInformation& findInformation, const char* dataItemValue, char* errorInfo, const int errorInfoLength) {
101
+ try {
102
+ auto tableControl = gcnew TableControl(Locator::FindFor(findInformation));
103
+ tableControl->Value = gcnew String(dataItemValue);
104
+ } catch(Exception^ e) {
105
+ StringHelper::Write(e, errorInfo, errorInfoLength);
106
+ }
107
+ }
108
+ }
@@ -0,0 +1,25 @@
1
+ #include "stdafx.h"
2
+ #include "Locator.h"
3
+ #include "StringHelper.h"
4
+
5
+ using namespace RAutomation::UIA::Controls;
6
+
7
+ extern "C" {
8
+ __declspec ( dllexport ) void Text_GetValue(const FindInformation& findInformation, char* theValue, const int maximumLength) {
9
+ try {
10
+ auto text = gcnew TextControl(Locator::FindFor(findInformation));
11
+ StringHelper::CopyToUnmanagedString(text->Value, theValue, maximumLength);
12
+ } catch(Exception^ e) {
13
+ Console::WriteLine("Text_GetValue: {0}", e->Message);
14
+ }
15
+ }
16
+
17
+ __declspec ( dllexport ) void Text_SetValue(const FindInformation& findInformation, const char* theValue) {
18
+ try {
19
+ auto text = gcnew TextControl(Locator::FindFor(findInformation));
20
+ text->Value = gcnew String(theValue);
21
+ } catch(Exception^ e) {
22
+ Console::WriteLine("Text_SetValue: {0}", e->Message);
23
+ }
24
+ }
25
+ }
@@ -0,0 +1,10 @@
1
+ #pragma once
2
+ class ToggleStateHelper
3
+ {
4
+ public:
5
+ ToggleStateHelper(void);
6
+ ~ToggleStateHelper(void);
7
+
8
+ BOOL IsSet(IUIAutomationElement* automationElement);
9
+ };
10
+
@@ -0,0 +1,216 @@
1
+ #include "stdafx.h"
2
+ #include "Locator.h"
3
+ #include "DynamicAssemblyResolver.h"
4
+ #include "StringHelper.h"
5
+
6
+ using namespace RAutomation::UIA;
7
+ using namespace RAutomation::UIA::Controls;
8
+ using namespace RAutomation::UIA::Extensions;
9
+
10
+ using namespace System::Diagnostics;
11
+
12
+ extern "C" {
13
+ __declspec(dllexport) void initialize(char* privateAssemblyDirectory) {
14
+ DynamicAssemblyResolver::PrivatePath = gcnew String(privateAssemblyDirectory);
15
+ }
16
+
17
+ __declspec ( dllexport ) bool ElementExists(const FindInformation& findInformation) {
18
+ return Element::Exists(Locator::FindFor(findInformation));
19
+ }
20
+
21
+ __declspec ( dllexport ) int NativeWindowHandle(const FindInformation& findInformation) {
22
+ return Element::NativeWindowHandle(Locator::FindFor(findInformation));
23
+ }
24
+
25
+ __declspec ( dllexport ) int HandleFromPoint(int xCoord, int yCoord) {
26
+ auto element = AutomationElement::FromPoint(Point((double)xCoord, (double)yCoord));
27
+ return Element::NativeWindowHandle(element);
28
+ }
29
+
30
+ __declspec ( dllexport ) int BoundingRectangle(const FindInformation& findInformation, long *rectangle) {
31
+ try {
32
+ auto boundary = Element::BoundingRectangle(Locator::FindFor(findInformation));
33
+
34
+ rectangle[0] = (long)boundary.Left;
35
+ rectangle[1] = (long)boundary.Top;
36
+ rectangle[2] = (long)boundary.Right;
37
+ rectangle[3] = (long)boundary.Bottom;
38
+ return 1;
39
+ }
40
+ catch(Exception^ e) {
41
+ Console::WriteLine("BoundingRectangle: {0}", e->Message);
42
+ return 0;
43
+ }
44
+ }
45
+
46
+ __declspec ( dllexport ) bool IsOffscreen(const FindInformation& findInformation) {
47
+ return Element::IsOffscreen(Locator::FindFor(findInformation));
48
+ }
49
+
50
+ __declspec ( dllexport ) int ControlType(const FindInformation& findInformation) {
51
+ try {
52
+ return Element::ControlType(Locator::FindFor(findInformation))->Id;
53
+ } catch(Exception^ e) {
54
+ Console::WriteLine("ControlType: {0}", e->Message);
55
+ return 0;
56
+ }
57
+ }
58
+
59
+ __declspec ( dllexport ) int ProcessId(const FindInformation& findInformation) {
60
+ try {
61
+ return Element::ProcessId(Locator::FindFor(findInformation));
62
+ } catch(Exception^ e) {
63
+ Console::WriteLine("ProcessId: {0}", e->Message);
64
+ return 0;
65
+ }
66
+ }
67
+
68
+ __declspec ( dllexport ) void Name(const FindInformation& findInformation, char* name, const int nameLength) {
69
+ try {
70
+ auto currentName = Element::Name(Locator::FindFor(findInformation));
71
+ StringHelper::CopyToUnmanagedString(currentName, name, nameLength);
72
+ } catch(Exception^ e) {
73
+ Console::WriteLine("Name: {0}", e->Message);
74
+ }
75
+ }
76
+
77
+ __declspec ( dllexport ) void ClassName(const FindInformation& findInformation, char* className, const int classNameLength) {
78
+ try {
79
+ auto currentClassName = Element::ClassName(Locator::FindFor(findInformation));
80
+ StringHelper::CopyToUnmanagedString(currentClassName, className, classNameLength);
81
+ } catch(Exception^ e) {
82
+ Console::WriteLine("ClassName: {0}", e->Message);
83
+ }
84
+ }
85
+
86
+ __declspec ( dllexport ) bool IsEnabled(const FindInformation& findInformation) {
87
+ try {
88
+ return Element::IsEnabled(Locator::FindFor(findInformation));
89
+ } catch(Exception^ e) {
90
+ Console::WriteLine("IsEnabled: {0}", e->Message);
91
+ return false;
92
+ }
93
+ }
94
+
95
+ __declspec ( dllexport ) bool IsFocused(const FindInformation& findInformation) {
96
+ try {
97
+ return Element::IsFocused(Locator::FindFor(findInformation));
98
+ } catch(Exception^ e) {
99
+ Console::WriteLine("IsFocused: {0}", e->Message);
100
+ return false;
101
+ }
102
+ }
103
+
104
+ __declspec ( dllexport ) bool SetControlFocus(const FindInformation& findInformation) {
105
+ try {
106
+ Locator::FindFor(findInformation)->SetFocus();
107
+ return true;
108
+ } catch(Exception^ e) {
109
+ Console::WriteLine("IsFocused: {0}", e->Message);
110
+ return false;
111
+ }
112
+ }
113
+
114
+ __declspec (dllexport) void SendKeys(const FindInformation& findInformation, const char* keysToSend, char* errorInfo, const long errorInfoLength) {
115
+ try {
116
+ Element::SendKeys(Locator::FindFor(findInformation), gcnew String(keysToSend));
117
+ } catch(Exception^ e) {
118
+ StringHelper::CopyToUnmanagedString(e->Message, errorInfo, errorInfoLength);
119
+ }
120
+ }
121
+
122
+ __declspec ( dllexport ) void HelpText(const FindInformation& findInformation, char* helpText, const int helpTextLength) {
123
+ try {
124
+ auto helpTextProperty = Element::HelpText(Locator::FindFor(findInformation));
125
+ StringHelper::CopyToUnmanagedString(helpTextProperty, helpText, helpTextLength);
126
+ } catch(Exception^ e) {
127
+ Console::WriteLine("HelpText: {0}", e->Message);
128
+ }
129
+ }
130
+
131
+ __declspec ( dllexport ) int GetClassNames(const FindInformation& findInformation, const char* classNames[]) {
132
+ auto allChildren = Locator::FindFor(findInformation)->FindAll(System::Windows::Automation::TreeScope::Subtree, Condition::TrueCondition);
133
+
134
+ if( NULL != classNames ) {
135
+ StringHelper::CopyClassNames(allChildren, classNames);
136
+ }
137
+
138
+ return allChildren->Count;
139
+ }
140
+
141
+ __declspec ( dllexport ) long ClickMouse() {
142
+ mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
143
+ mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
144
+ return 0;
145
+ }
146
+
147
+ __declspec ( dllexport ) long MoveMouse(int x, int y) {
148
+ return SetCursorPos(x,y);
149
+ }
150
+
151
+ __declspec ( dllexport ) bool IsSet(const FindInformation& findInformation) {
152
+ try {
153
+ return Element::IsToggled(Locator::FindFor(findInformation));
154
+ } catch(Exception^ e) {
155
+ Debug::WriteLine("IsSet: {0}", e->Message);
156
+ return false;
157
+ }
158
+ }
159
+
160
+ __declspec ( dllexport ) bool IsSelected(const FindInformation& findInformation) {
161
+ try {
162
+ return Element::IsSelected(Locator::FindFor(findInformation));
163
+ } catch(Exception^ e) {
164
+ Debug::WriteLine("IsSelected: {0}", e->Message);
165
+ return false;
166
+ }
167
+ }
168
+
169
+ __declspec ( dllexport ) bool Click(const FindInformation& findInformation, char* errorInfo, const int errorInfoSize) {
170
+ try {
171
+ return Clicker::Click(Locator::FindFor(findInformation));
172
+ } catch(Exception^ e) {
173
+ if( errorInfo ) {
174
+ StringHelper::CopyToUnmanagedString(e->ToString(), errorInfo, errorInfoSize);
175
+ }
176
+
177
+ return false;
178
+ }
179
+ }
180
+
181
+ __declspec ( dllexport ) void ExpandItemByValue(const FindInformation& findInformation, const char* whichItem) {
182
+ try {
183
+ auto expander = gcnew Expander(Locator::FindFor(findInformation));
184
+ expander->Expand(gcnew String(whichItem));
185
+ } catch(Exception^ e) {
186
+ Console::WriteLine(e->ToString());
187
+ }
188
+ }
189
+
190
+ __declspec ( dllexport ) void ExpandItemByIndex(const FindInformation& findInformation, const int whichItemIndex) {
191
+ try {
192
+ auto expander = gcnew Expander(Locator::FindFor(findInformation));
193
+ expander->Expand(whichItemIndex);
194
+ } catch(Exception^ e) {
195
+ Console::WriteLine(e->ToString());
196
+ }
197
+ }
198
+
199
+ __declspec ( dllexport ) void CollapseItemByValue(const FindInformation& findInformation, const char* whichItem) {
200
+ try {
201
+ auto collapser = gcnew Collapser(Locator::FindFor(findInformation));
202
+ collapser->Collapse(gcnew String(whichItem));
203
+ } catch(Exception^ e) {
204
+ Console::WriteLine(e->ToString());
205
+ }
206
+ }
207
+
208
+ __declspec ( dllexport ) void CollapseItemByIndex(const FindInformation& findInformation, const int whichItemIndex) {
209
+ try {
210
+ auto collapser = gcnew Collapser(Locator::FindFor(findInformation));
211
+ collapser->Collapse(whichItemIndex);
212
+ } catch(Exception^ e) {
213
+ Console::WriteLine(e->ToString());
214
+ }
215
+ }
216
+ }
@@ -0,0 +1,13 @@
1
+ // UiaDll.h
2
+
3
+ #pragma once
4
+
5
+ using namespace System;
6
+
7
+ namespace UiaDll {
8
+
9
+ public ref class Class1
10
+ {
11
+ // TODO: Add your methods for this class here.
12
+ };
13
+ }