rautomation 0.10.0 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/History.rdoc +7 -1
  4. data/VERSION +1 -1
  5. data/ext/UiaDll/RAutomation.UIA/Controls/Clicker.cs +59 -0
  6. data/ext/UiaDll/RAutomation.UIA/Controls/SelectList.cs +76 -0
  7. data/ext/UiaDll/RAutomation.UIA/Controls/Spinner.cs +46 -0
  8. data/ext/UiaDll/RAutomation.UIA/Controls/TabControl.cs +54 -0
  9. data/ext/UiaDll/RAutomation.UIA/Controls/TableControl.cs +87 -0
  10. data/ext/UiaDll/RAutomation.UIA/Controls/TextControl.cs +50 -0
  11. data/ext/UiaDll/RAutomation.UIA/Expander.cs +59 -0
  12. data/ext/UiaDll/RAutomation.UIA/Extensions/Element.cs +108 -0
  13. data/ext/UiaDll/RAutomation.UIA/Extensions/Enumerable.cs +63 -0
  14. data/ext/UiaDll/RAutomation.UIA/Extensions/Property.cs +27 -0
  15. data/ext/UiaDll/RAutomation.UIA/Properties/AssemblyInfo.cs +36 -0
  16. data/ext/UiaDll/RAutomation.UIA/Properties/AutomationProperties.cs +18 -0
  17. data/ext/UiaDll/RAutomation.UIA/RAutomation.UIA.csproj +68 -0
  18. data/ext/UiaDll/UiaDll.sln +24 -2
  19. data/ext/UiaDll/UiaDll/ControlMethods.cpp +6 -5
  20. data/ext/UiaDll/UiaDll/DynamicAssemblyResolver.cpp +24 -0
  21. data/ext/UiaDll/UiaDll/DynamicAssemblyResolver.h +16 -0
  22. data/ext/UiaDll/UiaDll/{AutomationFinder.cpp → Locator.cpp} +25 -15
  23. data/ext/UiaDll/UiaDll/{AutomationFinder.h → Locator.h} +4 -2
  24. data/ext/UiaDll/UiaDll/MenuItemSelector.cpp +3 -3
  25. data/ext/UiaDll/UiaDll/MenuMethods.cpp +4 -0
  26. data/ext/UiaDll/UiaDll/SelectListMethods.cpp +40 -21
  27. data/ext/UiaDll/UiaDll/SpinnerMethods.cpp +61 -0
  28. data/ext/UiaDll/UiaDll/StringHelper.cpp +13 -1
  29. data/ext/UiaDll/UiaDll/StringHelper.h +1 -0
  30. data/ext/UiaDll/UiaDll/TabControlMethods.cpp +11 -8
  31. data/ext/UiaDll/UiaDll/TableMethods.cpp +20 -21
  32. data/ext/UiaDll/UiaDll/TextMethods.cpp +19 -17
  33. data/ext/UiaDll/UiaDll/UiaDll.cpp +191 -342
  34. data/ext/UiaDll/UiaDll/UiaDll.vcxproj +11 -21
  35. data/ext/UiaDll/UiaDll/UiaDll.vcxproj.filters +22 -115
  36. data/ext/UiaDll/UiaDll/dllmain.cpp +1 -21
  37. data/ext/UiaDll/UiaDll/stdafx.h +0 -2
  38. data/ext/WindowsForms/WindowsForms/DataEntryForm.Designer.cs +17 -0
  39. data/ext/WindowsForms/WindowsForms/DataEntryForm.cs +2 -6
  40. data/ext/WindowsForms/WindowsForms/MainFormWindow.Designer.cs +6 -7
  41. data/ext/WindowsForms/WindowsForms/MainFormWindow.cs +2 -0
  42. data/ext/WindowsForms/WindowsForms/UIA.Extensions.dll +0 -0
  43. data/ext/WindowsForms/WindowsForms/ValueMonthCalendar.cs +28 -0
  44. data/ext/WindowsForms/WindowsForms/WindowsForms.csproj +5 -4
  45. data/lib/rautomation/adapter/ms_uia.rb +1 -0
  46. data/lib/rautomation/adapter/ms_uia/control.rb +1 -13
  47. data/lib/rautomation/adapter/ms_uia/functions.rb +2 -16
  48. data/lib/rautomation/adapter/ms_uia/list_box.rb +2 -2
  49. data/lib/rautomation/adapter/ms_uia/spinner.rb +31 -0
  50. data/lib/rautomation/adapter/ms_uia/uia_dll.rb +59 -31
  51. data/lib/rautomation/adapter/ms_uia/window.rb +5 -4
  52. data/rautomation.gemspec +1 -0
  53. data/spec/adapter/ms_uia/spinner_spec.rb +44 -0
  54. data/spec/adapter/ms_uia/value_control_spec.rb +2 -2
  55. metadata +26 -25
  56. data/ext/UiaDll/UiaDll/AutomatedSelectList.cpp +0 -93
  57. data/ext/UiaDll/UiaDll/AutomatedSelectList.h +0 -47
  58. data/ext/UiaDll/UiaDll/AutomatedTabControl.cpp +0 -45
  59. data/ext/UiaDll/UiaDll/AutomatedTabControl.h +0 -41
  60. data/ext/UiaDll/UiaDll/AutomatedTable.cpp +0 -92
  61. data/ext/UiaDll/UiaDll/AutomatedTable.h +0 -35
  62. data/ext/UiaDll/UiaDll/AutomatedText.cpp +0 -22
  63. data/ext/UiaDll/UiaDll/AutomatedText.h +0 -26
  64. data/ext/UiaDll/UiaDll/AutomationClicker.cpp +0 -53
  65. data/ext/UiaDll/UiaDll/AutomationClicker.h +0 -30
  66. data/ext/UiaDll/UiaDll/AutomationControl.cpp +0 -40
  67. data/ext/UiaDll/UiaDll/AutomationControl.h +0 -75
  68. data/ext/UiaDll/UiaDll/ExpandCollapseHelper.cpp +0 -53
  69. data/ext/UiaDll/UiaDll/ExpandCollapseHelper.h +0 -25
  70. data/ext/UiaDll/UiaDll/SelectionItem.cpp +0 -10
  71. data/ext/UiaDll/UiaDll/SelectionItem.h +0 -21
  72. data/ext/UiaDll/UiaDll/Toggle.cpp +0 -2
  73. data/ext/UiaDll/UiaDll/Toggle.h +0 -22
  74. data/ext/UiaDll/UiaDll/globals.h +0 -3
  75. data/ext/WindowsForms/WindowsForms/AutomatableMonthCalendar.cs +0 -59
  76. data/ext/WindowsForms/WindowsForms/AutomationHelpers/AutomationProvider.cs +0 -91
@@ -2,10 +2,12 @@
2
2
  using namespace System::Windows;
3
3
  using namespace System::Windows::Automation;
4
4
 
5
- ref class AutomationFinder
5
+ ref class Locator
6
6
  {
7
7
  public:
8
- AutomationFinder(AutomationElement^ automationElement);
8
+ static AutomationElement^ FindFor(const FindInformation& findInformation);
9
+
10
+ Locator(AutomationElement^ automationElement);
9
11
  AutomationElement^ Find(const FindInformation& findInformation);
10
12
  AutomationElementCollection^ Find(...array<Condition^>^ conditions);
11
13
  AutomationElementCollection^ Find(const UIAutomation::TreeScope scope, ...array<Condition^>^ conditions);
@@ -16,7 +16,7 @@ BOOL MenuItemSelector::MenuItemExists(const HWND windowHandle, list<const char*>
16
16
  try {
17
17
  auto automationElement = AutomationElement::FromHandle(IntPtr(windowHandle));
18
18
  return FindMenuItem(automationElement, menuItems) != nullptr;
19
- } catch(Exception^ e) {
19
+ } catch(Exception^) {
20
20
  return FALSE;
21
21
  }
22
22
  }
@@ -54,7 +54,7 @@ ExpandCollapsePattern^ MenuItemSelector::AsExpandCollapse(AutomationElement^ fou
54
54
  {
55
55
  return dynamic_cast<ExpandCollapsePattern^>(foundMenuItem->GetCurrentPattern(ExpandCollapsePattern::Pattern));
56
56
  }
57
- catch(Exception^ e)
57
+ catch(Exception^)
58
58
  {
59
59
  return nullptr;
60
60
  }
@@ -68,7 +68,7 @@ void MenuItemSelector::TryToExpand(ExpandCollapsePattern^ expandCollapsePattern)
68
68
  {
69
69
  expandCollapsePattern->Expand();
70
70
  }
71
- catch(Exception^ e)
71
+ catch(Exception^)
72
72
  {
73
73
  expandCollapsePattern->Expand();
74
74
  }
@@ -6,6 +6,7 @@ void MenuSelectPath(const HWND windowHandle, char* errorInfo, const int errorInf
6
6
 
7
7
  extern "C" {
8
8
 
9
+ #pragma managed(push, off)
9
10
  __declspec ( dllexport ) void Menu_SelectPath(const HWND windowHandle, char* errorInfo, const int errorInfoSize, const char* arg0, ...) {
10
11
  va_list arguments;
11
12
  va_start(arguments, arg0);
@@ -21,7 +22,9 @@ extern "C" {
21
22
 
22
23
  MenuSelectPath(windowHandle, errorInfo, errorInfoSize, menuItems);
23
24
  }
25
+ #pragma managed(pop)
24
26
 
27
+ #pragma managed(push, off)
25
28
  __declspec ( dllexport ) BOOL Menu_ItemExists(const HWND windowHandle, const char* arg0, ...) {
26
29
  va_list arguments;
27
30
  va_start(arguments, arg0);
@@ -37,6 +40,7 @@ extern "C" {
37
40
 
38
41
  return MenuItemExists(windowHandle, menuItems);
39
42
  }
43
+ #pragma managed(pop)
40
44
  }
41
45
 
42
46
  BOOL MenuItemExists(const HWND windowHandle, std::list<const char*>& menuItems)
@@ -1,42 +1,61 @@
1
1
  #include "stdafx.h"
2
- #include "AutomatedSelectList.h"
2
+ #include "Locator.h"
3
+ #include "StringHelper.h"
4
+
5
+ using namespace RAutomation::UIA::Controls;
3
6
 
4
7
  extern "C" {
5
8
 
6
9
  __declspec ( dllexport ) int SelectList_Count(const FindInformation& findInformation) {
7
- auto autoSelectList = gcnew AutomatedSelectList(findInformation);
8
- return autoSelectList->Count;
10
+ auto selectList = gcnew SelectList(Locator::FindFor(findInformation));
11
+ return selectList->Count;
9
12
  }
10
13
 
11
- __declspec ( dllexport ) int SelectList_Options(const FindInformation& findInformation, const char* options[]) {
12
- auto selectList = gcnew AutomatedSelectList(findInformation);
13
- return selectList->GetOptions(options);
14
- }
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
+ }
15
18
 
16
19
  __declspec ( dllexport ) int SelectList_SelectedIndex(const FindInformation& findInformation) {
17
- auto autoSelectList = gcnew AutomatedSelectList(findInformation);
18
- return autoSelectList->SelectedIndex;
20
+ auto selectList = gcnew SelectList(Locator::FindFor(findInformation));
21
+ return selectList->SelectedIndex;
19
22
  }
20
23
 
21
- __declspec ( dllexport ) void SelectList_Selection(const FindInformation& findInformation, char* selection, const int selectionLength) {
22
- auto selectList = gcnew AutomatedSelectList(findInformation);
23
- auto currentSelections = selectList->Selection;
24
- auto firstSelection = currentSelections.Length == 0 ? "" : currentSelections[0];
25
- StringHelper::CopyToUnmanagedString(firstSelection, selection, selectionLength);
26
- }
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
+ }
27
28
 
28
29
  __declspec ( dllexport ) bool SelectList_ValueAt(const FindInformation& findInformation, const int whichItem, char* comboValue, const int comboValueSize) {
29
- auto autoSelectList = gcnew AutomatedSelectList(findInformation);
30
- return autoSelectList->GetValueByIndex(whichItem, comboValue, comboValueSize);
30
+ try {
31
+ auto selectList = gcnew SelectList(Locator::FindFor(findInformation));
32
+ StringHelper::CopyToUnmanagedString(selectList->At(whichItem), comboValue, comboValueSize);
33
+ return true;
34
+ } catch(Exception^ e) {
35
+ Console::WriteLine(e);
36
+ return false;
37
+ }
31
38
  }
32
39
 
33
40
  __declspec ( dllexport ) bool SelectList_SelectIndex(const FindInformation& findInformation, const int whichItem) {
34
- auto autoSelectList = gcnew AutomatedSelectList(findInformation);
35
- return autoSelectList->SelectByIndex(whichItem);
41
+ try {
42
+ auto selectList = gcnew SelectList(Locator::FindFor(findInformation));
43
+ selectList->SelectedIndex = whichItem;
44
+ return true;
45
+ } catch(Exception^ e) {
46
+ Console::WriteLine(e);
47
+ return false;
48
+ }
36
49
  }
37
50
 
38
51
  __declspec ( dllexport ) int SelectList_SelectValue(const FindInformation& findInformation, char *pValue) {
39
- auto autoSelectList = gcnew AutomatedSelectList(findInformation);
40
- return autoSelectList->SelectByValue(pValue);
52
+ try {
53
+ auto selectList = gcnew SelectList(Locator::FindFor(findInformation));
54
+ selectList->Selection = gcnew String(pValue);
55
+ return true;
56
+ } catch(Exception^ e) {
57
+ Console::WriteLine(e);
58
+ return false;
59
+ }
41
60
  }
42
61
  }
@@ -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
+ }
@@ -4,7 +4,7 @@
4
4
  void StringHelper::CopyToUnmanagedString(String^ source, char* destination, const int destinationSize)
5
5
  {
6
6
  auto unmanagedString = Marshal::StringToHGlobalAnsi(source);
7
- strncpy(destination, (const char*)(void*)unmanagedString, destinationSize);
7
+ strncpy_s(destination, destinationSize, (const char*)(void*)unmanagedString, _TRUNCATE);
8
8
  Marshal::FreeHGlobal(unmanagedString);
9
9
  }
10
10
 
@@ -23,6 +23,18 @@ void StringHelper::FreeUp(const char* unmanagedStrings[], const int numberOfStri
23
23
  }
24
24
  }
25
25
 
26
+ int StringHelper::Copy(array<String^>^ strings, const char* unmanagedStrings[])
27
+ {
28
+ if( NULL != unmanagedStrings ) {
29
+ auto whichItem = 0;
30
+ for each(String^ theString in strings) {
31
+ unmanagedStrings[whichItem++] = UnmanagedStringFrom(theString);
32
+ }
33
+ }
34
+
35
+ return strings->Length;
36
+ }
37
+
26
38
  void StringHelper::CopyNames(AutomationElementCollection^ automationElements, const char* unmanagedStrings[])
27
39
  {
28
40
  auto whichItem = 0;
@@ -7,6 +7,7 @@ public:
7
7
  static void CopyToUnmanagedString(String^ source, char* destination, const int destinationSize);
8
8
  static char* UnmanagedStringFrom(String^ source);
9
9
  static void FreeUp(const char* unmanagedStrings[], const int numberOfStrings);
10
+ static int Copy(array<String^>^ strings, const char* unmanagedStrings[]);
10
11
  static void CopyNames(AutomationElementCollection^ automationElements, const char* unmanagedStrings[]);
11
12
  static void CopyClassNames(AutomationElementCollection^ automationElements, const char* unmanagedStrings[]);
12
13
  };
@@ -1,34 +1,37 @@
1
1
  #include "stdafx.h"
2
- #include "AutomatedTabControl.h"
2
+ #include "Locator.h"
3
+ #include "StringHelper.h"
4
+
5
+ using namespace RAutomation::UIA::Controls;
3
6
 
4
7
  extern "C" {
5
8
  __declspec(dllexport) int TabControl_Items(const FindInformation& findInformation, const char* options[]) {
6
- auto tabControl = gcnew AutomatedTabControl(findInformation);
7
- return tabControl->GetTabItems(options);
9
+ auto tabControl = gcnew TabControl(Locator::FindFor(findInformation));
10
+ return StringHelper::Copy(tabControl->TabNames, options);
8
11
  }
9
12
 
10
13
  __declspec(dllexport) void TabControl_Selection(const FindInformation& findInformation, char* selection, const int selectionLength) {
11
- auto tabControl = gcnew AutomatedTabControl(findInformation);
14
+ auto tabControl = gcnew TabControl(Locator::FindFor(findInformation));
12
15
  StringHelper::CopyToUnmanagedString(tabControl->Selection, selection, selectionLength);
13
16
  }
14
17
 
15
18
  __declspec(dllexport) void TabControl_SelectByIndex(const FindInformation& findInformation, const int index, char* errorInfo, const int errorInfoLength) {
16
19
  try {
17
- auto tabControl = gcnew AutomatedTabControl(findInformation);
18
- tabControl->SelectedIndex = index;
20
+ auto tabControl = gcnew TabControl(Locator::FindFor(findInformation));
21
+ return tabControl->SelectedIndex = index;
19
22
  } catch(Exception^) {
20
23
  _snprintf(errorInfo, errorInfoLength, "A tab with index %d was not found", index);
21
24
  }
22
25
  }
23
26
 
24
27
  __declspec(dllexport) int TabControl_SelectedIndex(const FindInformation& findInformation) {
25
- auto tabControl = gcnew AutomatedTabControl(findInformation);
28
+ auto tabControl = gcnew TabControl(Locator::FindFor(findInformation));
26
29
  return tabControl->SelectedIndex;
27
30
  }
28
31
 
29
32
  __declspec(dllexport) void TabControl_SelectByValue(const FindInformation& findInformation, const char* value, char* errorInfo, const int errorInfoLength) {
30
33
  try {
31
- auto tabControl = gcnew AutomatedTabControl(findInformation);
34
+ auto tabControl = gcnew TabControl(Locator::FindFor(findInformation));
32
35
  tabControl->Selection = gcnew String(value);
33
36
  } catch(Exception^) {
34
37
  _snprintf(errorInfo, errorInfoLength, "A tab with the value %s was not found", value);
@@ -1,35 +1,34 @@
1
1
  #include "stdafx.h"
2
- #include "AutomatedTable.h"
2
+ #include "Locator.h"
3
+ #include "StringHelper.h"
4
+
5
+ using namespace RAutomation::UIA::Controls;
3
6
 
4
7
  extern "C" {
5
8
 
6
9
  __declspec ( dllexport ) int Table_GetHeaders(const FindInformation& findInformation, const char* headers[]) {
7
- auto tableControl = gcnew AutomatedTable(findInformation);
8
- return tableControl->GetHeaders(headers);
10
+ auto tableControl = gcnew TableControl(Locator::FindFor(findInformation));
11
+ return StringHelper::Copy(tableControl->Headers, headers);
9
12
  }
10
13
 
11
14
  __declspec ( dllexport ) int Table_GetValues(const FindInformation& findInformation, const char* values[]) {
12
- auto tableControl = gcnew AutomatedTable(findInformation);
13
- return tableControl->GetValues(values);
15
+ auto tableControl = gcnew TableControl(Locator::FindFor(findInformation));
16
+ return StringHelper::Copy(tableControl->Values, values);
14
17
  }
15
18
 
16
- __declspec ( dllexport ) int Table_FindValues(const FindInformation& findInformation, const char* values[]) {
17
- auto tableControl = gcnew AutomatedTable(findInformation);
18
- return tableControl->GetValues(values);
19
- }
20
-
21
19
  __declspec ( dllexport ) int Table_RowCount(const FindInformation& findInformation) {
22
20
  try {
23
- auto tableControl = gcnew AutomatedTable(findInformation);
21
+ auto tableControl = gcnew TableControl(Locator::FindFor(findInformation));
24
22
  return tableControl->RowCount;
25
23
  } catch(Exception^ e) {
26
24
  Console::WriteLine(e->ToString());
25
+ return 0;
27
26
  }
28
27
  }
29
28
 
30
29
  __declspec ( dllexport ) bool Table_CoordinateIsValid(const FindInformation& findInformation, const int whichItemIndex, const int whichColumnIndex) {
31
30
  try {
32
- auto tableControl = gcnew AutomatedTable(findInformation);
31
+ auto tableControl = gcnew TableControl(Locator::FindFor(findInformation));
33
32
  return tableControl->Exists(whichItemIndex, whichColumnIndex);
34
33
  } catch(Exception^ e) {
35
34
  Console::WriteLine(e->ToString());
@@ -39,9 +38,8 @@ extern "C" {
39
38
 
40
39
  __declspec ( dllexport ) void Table_ValueAt(const FindInformation& findInformation, const int row, const int column, char *foundValue, const int foundValueLength) {
41
40
  try {
42
- auto tableControl = gcnew AutomatedTable(findInformation);
43
- auto rowValue = tableControl->ValueAt(row, column);
44
- StringHelper::CopyToUnmanagedString(rowValue, foundValue, foundValueLength);
41
+ auto tableControl = gcnew TableControl(Locator::FindFor(findInformation));
42
+ StringHelper::CopyToUnmanagedString(tableControl->ValueAt(row, column), foundValue, foundValueLength);
45
43
  } catch(Exception^ e) {
46
44
  Console::WriteLine(e->ToString());
47
45
  }
@@ -49,8 +47,8 @@ extern "C" {
49
47
 
50
48
  __declspec ( dllexport ) void Table_SelectByIndex(const FindInformation& findInformation, const int dataItemIndex) {
51
49
  try {
52
- auto tableControl = gcnew AutomatedTable(findInformation);
53
- tableControl->Select(dataItemIndex);
50
+ auto tableControl = gcnew TableControl(Locator::FindFor(findInformation));
51
+ tableControl->SelectedIndex = dataItemIndex;
54
52
  } catch(Exception^ e) {
55
53
  Console::WriteLine(e->ToString());
56
54
  }
@@ -58,17 +56,18 @@ extern "C" {
58
56
 
59
57
  __declspec ( dllexport ) bool Table_IsSelectedByIndex(const FindInformation& findInformation, const int dataItemIndex) {
60
58
  try {
61
- auto tableControl = gcnew AutomatedTable(findInformation);
62
- return tableControl->IsSelected(dataItemIndex);
59
+ auto tableControl = gcnew TableControl(Locator::FindFor(findInformation));
60
+ return tableControl->SelectedIndex == dataItemIndex;
63
61
  } catch(Exception^ e) {
64
62
  Console::WriteLine(e->ToString());
63
+ return false;
65
64
  }
66
65
  }
67
66
 
68
67
  __declspec ( dllexport ) void Table_SelectByValue(const FindInformation& findInformation, const char* dataItemValue) {
69
68
  try {
70
- auto tableControl = gcnew AutomatedTable(findInformation);
71
- tableControl->Select(dataItemValue);
69
+ auto tableControl = gcnew TableControl(Locator::FindFor(findInformation));
70
+ tableControl->Value = gcnew String(dataItemValue);
72
71
  } catch(Exception^ e) {
73
72
  Console::WriteLine(e->ToString());
74
73
  }
@@ -1,23 +1,25 @@
1
1
  #include "stdafx.h"
2
- #include "AutomatedText.h"
2
+ #include "Locator.h"
3
3
  #include "StringHelper.h"
4
4
 
5
+ using namespace RAutomation::UIA::Controls;
6
+
5
7
  extern "C" {
6
- __declspec ( dllexport ) void Text_GetValue(const FindInformation& findInformation, char* theValue, const int maximumLength) {
7
- try {
8
- auto control = gcnew AutomatedText(findInformation);
9
- StringHelper::CopyToUnmanagedString(control->Text, theValue, maximumLength);
10
- } catch(Exception^ e) {
11
- Console::WriteLine("Text_GetValue: {0}", e->Message);
12
- }
13
- }
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
+ }
14
16
 
15
- __declspec ( dllexport ) void Text_SetValue(const FindInformation& findInformation, const char* theValue) {
16
- try {
17
- auto control = gcnew AutomatedText(findInformation);
18
- control->Text = gcnew String(theValue);
19
- } catch(Exception^ e) {
20
- Console::WriteLine("Text_SetValue: {0}", e->Message);
21
- }
22
- }
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
+ }
23
25
  }
@@ -1,350 +1,199 @@
1
- // UiaDll.cpp : Defines the exported functions for the DLL application.
2
- //
3
-
4
1
  #include "stdafx.h"
5
- #include "AutomationClicker.h"
6
- #include "AutomationControl.h"
7
- #include "AutomationFinder.h"
8
- #include "ExpandCollapseHelper.h"
2
+ #include "Locator.h"
3
+ #include "DynamicAssemblyResolver.h"
9
4
  #include "StringHelper.h"
10
- #include "SelectionItem.h"
11
- #include "Toggle.h"
12
-
13
- IUIAutomation* getGlobalIUIAutomation() ;
14
-
15
- extern "C" {
16
-
17
- __declspec ( dllexport ) bool ElementExists(const FindInformation& findInformation) {
18
- auto automationElement = gcnew AutomationControl(findInformation);
19
- return automationElement->Exists;
20
- }
21
-
22
- __declspec ( dllexport ) int NativeWindowHandle(const FindInformation& findInformation) {
23
- auto automationElement = gcnew AutomationControl(findInformation);
24
- return automationElement->Exists ? automationElement->Element->Current.NativeWindowHandle : 0;
25
- }
26
-
27
- __declspec ( dllexport ) int BoundingRectangle(const FindInformation& findInformation, long *rectangle) {
28
- try {
29
- auto automationElement = gcnew AutomationControl(findInformation);
30
- auto boundary = automationElement->BoundingRectangle;
31
-
32
- rectangle[0] = boundary.Left;
33
- rectangle[1] = boundary.Top;
34
- rectangle[2] = boundary.Right;
35
- rectangle[3] = boundary.Bottom;
36
- return 1;
37
- }
38
- catch(Exception^ e) {
39
- Console::WriteLine("BoundingRectangle: {0}", e->Message);
40
- return 0;
41
- }
42
- }
43
-
44
- __declspec ( dllexport ) int ControlType(const FindInformation& findInformation) {
45
- try {
46
- auto automationElement = gcnew AutomationControl(findInformation);
47
- return automationElement->ControlType->Id;
48
- } catch(Exception^ e) {
49
- Console::WriteLine("ControlType: {0}", e->Message);
50
- return 0;
51
- }
52
- }
53
-
54
- __declspec ( dllexport ) int ProcessId(const FindInformation& findInformation) {
55
- try {
56
- auto automationElement = gcnew AutomationControl(findInformation);
57
- return automationElement->ProcessId;
58
- } catch(Exception^ e) {
59
- Console::WriteLine("ProcessId: {0}", e->Message);
60
- return 0;
61
- }
62
- }
63
-
64
- __declspec ( dllexport ) void Name(const FindInformation& findInformation, char* name, const int nameLength) {
65
- try {
66
- auto control = gcnew AutomationControl(findInformation);
67
- StringHelper::CopyToUnmanagedString(control->Name, name, nameLength);
68
- } catch(Exception^ e) {
69
- Console::WriteLine("Name: {0}", e->Message);
70
- }
71
- }
72
-
73
- __declspec ( dllexport ) void ClassName(const FindInformation& findInformation, char* className, const int classNameLength) {
74
- try {
75
- auto control = gcnew AutomationControl(findInformation);
76
- StringHelper::CopyToUnmanagedString(control->ClassName, className, classNameLength);
77
- } catch(Exception^ e) {
78
- Console::WriteLine("ClassName: {0}", e->Message);
79
- }
80
- }
81
-
82
- __declspec ( dllexport ) bool IsEnabled(const FindInformation& findInformation) {
83
- try {
84
- return (gcnew AutomationControl(findInformation))->IsEnabled;
85
- } catch(Exception^ e) {
86
- Console::WriteLine("IsEnabled: {0}", e->Message);
87
- return false;
88
- }
89
- }
90
-
91
- __declspec ( dllexport ) bool IsFocused(const FindInformation& findInformation) {
92
- try {
93
- return (gcnew AutomationControl(findInformation))->IsFocused;
94
- } catch(Exception^ e) {
95
- Console::WriteLine("IsFocused: {0}", e->Message);
96
- return false;
97
- }
98
- }
99
-
100
- __declspec ( dllexport ) bool SetControlFocus(const FindInformation& findInformation) {
101
- try {
102
- (gcnew AutomationControl(findInformation))->Element->SetFocus();
103
- return true;
104
- } catch(Exception^ e) {
105
- Console::WriteLine("IsFocused: {0}", e->Message);
106
- return false;
107
- }
108
- }
109
-
110
- __declspec ( dllexport ) int GetClassNames(const FindInformation& findInformation, const char* classNames[]) {
111
- auto control = gcnew AutomationControl(findInformation);
112
- auto finder = gcnew AutomationFinder(control->Element);
113
-
114
- auto allChildren = finder->Find();
115
-
116
- if( NULL != classNames ) {
117
- StringHelper::CopyClassNames(allChildren, classNames);
118
- }
119
-
120
- return allChildren->Count;
121
- }
122
-
123
- __declspec ( dllexport ) IUIAutomationElement *RA_ElementFromHandle(HWND hwnd) {
124
- IUIAutomationElement *pElement ;
125
-
126
- HRESULT hr = getGlobalIUIAutomation()->ElementFromHandle(hwnd, &pElement) ;
127
- if (SUCCEEDED(hr))
128
- return pElement ;
129
- else {
130
- printf("RA_ElementFromHandle: Cannot find element from handle 0x%x. HRESULT was 0x%x\r\n", hwnd, hr) ;
131
- return NULL ;
132
- }
133
- }
134
-
135
- __declspec ( dllexport ) IUIAutomationElement *RA_ElementFromPoint(int xCoord, int yCoord) {
136
- IUIAutomationElement *pElement ;
137
- POINT point;
138
-
139
- point.x = xCoord;
140
- point.y = yCoord;
141
-
142
- HRESULT hr = getGlobalIUIAutomation()->ElementFromPoint(point, &pElement) ;
143
- if (SUCCEEDED(hr))
144
- return pElement ;
145
- else {
146
- printf("RA_ElementFromPoint: Cannot find element from point %d , %d. HRESULT was 0x%x\r\n", xCoord, yCoord, hr) ;
147
- return NULL ;
148
- }
149
- }
150
5
 
151
- __declspec ( dllexport ) HWND RA_CurrentNativeWindowHandle(IUIAutomationElement *pElement) {
152
- UIA_HWND uia_hwnd ;
6
+ using namespace RAutomation::UIA;
7
+ using namespace RAutomation::UIA::Controls;
8
+ using namespace RAutomation::UIA::Extensions;
153
9
 
154
- if (pElement == NULL) {
155
- printf("RA_CurrentNativeWindowHandle: Cannot operate on NULL element\r\n") ;
156
- return (HWND)0 ;
157
- }
10
+ using namespace System::Diagnostics;
158
11
 
159
- pElement->get_CurrentNativeWindowHandle(&uia_hwnd) ;
160
- return (HWND)uia_hwnd ;
161
- }
162
-
163
- __declspec ( dllexport ) int RA_GetCurrentControlType(IUIAutomationElement *pElement) {
164
- CONTROLTYPEID control_type ;
165
-
166
- HRESULT hr = pElement->get_CurrentControlType(&control_type) ;
167
- if (SUCCEEDED(hr))
168
- return control_type ;
169
- else {
170
- printf("RA_GetCurrentControlType: CurrentControlType returned 0x%x\r\n", hr) ;
171
- return 0 ;
172
- }
173
- }
174
-
175
- __declspec ( dllexport ) long RA_ClickMouse() {
176
- mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
177
- mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
178
- return 0;
179
- }
180
-
181
- __declspec ( dllexport ) long RA_MoveMouse(int x, int y) {
182
- return SetCursorPos(x,y);
183
- }
184
-
185
- __declspec ( dllexport ) int RA_CurrentIsOffscreen(IUIAutomationElement *pElement, int *visible) {
186
- BOOL offscreen;
187
-
188
- HRESULT hr = pElement->get_CurrentIsOffscreen(&offscreen) ;
189
- if (SUCCEEDED(hr)) {
190
- if(offscreen){
191
- *visible = 1;
192
- }
193
- else
194
- {
195
- *visible = 0;
196
- }
197
- return 1;
198
- }
199
- else {
200
- printf("RA_CurrentIsOffscreen: get_CurrentIsOffscreen failed 0x%x\r\n", hr) ;
201
- return 0 ;
202
- }
203
- }
204
-
205
- __declspec ( dllexport ) int RA_FindChildren(IUIAutomationElement *pElement, IUIAutomationElement *pChildren[]) {
206
- IUIAutomationCondition *pTrueCondition ;
207
- IUIAutomationElementArray *pElementArray ;
208
- int element_count ;
209
-
210
- HRESULT hr = getGlobalIUIAutomation()->CreateTrueCondition(&pTrueCondition) ;
211
- if (FAILED(hr)) {
212
- printf("RA_FindChildren: Could not create true condition 0x%x\r\n", hr) ;
213
- return 0 ;
214
- }
215
-
216
- hr = pElement->FindAll(TreeScope_Children, pTrueCondition, &pElementArray) ;
217
- if (FAILED(hr)) {
218
- printf("RA_FindChildren: FindAll failed 0x%x\r\n", hr) ;
219
- return 0 ;
220
- }
221
-
222
- hr = pElementArray->get_Length(&element_count) ;
223
- if (FAILED(hr)) {
224
- printf("RA_FindChildren: get_length failed 0x%x\r\n", hr) ;
225
- return 0 ;
226
- }
227
-
228
- if (pChildren != NULL) {
229
- // given some memory get the details
230
- for (int index = 0; index < element_count; index++) {
231
- IUIAutomationElement *pElement ;
232
-
233
- hr = pElementArray->GetElement(index, &pElement) ;
234
- if (FAILED(hr)) {
235
- printf("RA_FindChildren: GetElement failed 0x%x\r\n", hr) ;
236
- } else {
237
- pChildren[index] = pElement ;
238
- }
239
- }
240
- }
241
-
242
- return element_count ;
243
- }
244
-
245
- __declspec ( dllexport ) bool RA_GetControlName(const HWND windowHandle, char* windowName, const int windowNameLength) {
246
- try {
247
- auto control = gcnew AutomationControl(windowHandle);
248
- StringHelper::CopyToUnmanagedString(control->Name, windowName, windowNameLength);
249
- return true;
250
- } catch(Exception^ e) {
251
- return false;
252
- }
253
- }
254
-
255
- __declspec ( dllexport ) bool IsSet(const FindInformation& findInformation) {
256
- try {
257
- auto toggle = gcnew Toggle(findInformation);
258
- return toggle->IsSet;
259
- } catch(Exception^ e) {
260
- Debug::WriteLine("IsSet: {0}", e->Message);
261
- return false;
262
- }
263
- }
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 ) int GetClassNames(const FindInformation& findInformation, const char* classNames[]) {
115
+ auto allChildren = Locator::FindFor(findInformation)->FindAll(System::Windows::Automation::TreeScope::Subtree, Condition::TrueCondition);
116
+
117
+ if( NULL != classNames ) {
118
+ StringHelper::CopyClassNames(allChildren, classNames);
119
+ }
120
+
121
+ return allChildren->Count;
122
+ }
123
+
124
+ __declspec ( dllexport ) long ClickMouse() {
125
+ mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
126
+ mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
127
+ return 0;
128
+ }
129
+
130
+ __declspec ( dllexport ) long MoveMouse(int x, int y) {
131
+ return SetCursorPos(x,y);
132
+ }
133
+
134
+ __declspec ( dllexport ) bool IsSet(const FindInformation& findInformation) {
135
+ try {
136
+ return Element::IsToggled(Locator::FindFor(findInformation));
137
+ } catch(Exception^ e) {
138
+ Debug::WriteLine("IsSet: {0}", e->Message);
139
+ return false;
140
+ }
141
+ }
142
+
143
+ __declspec ( dllexport ) bool IsSelected(const FindInformation& findInformation) {
144
+ try {
145
+ return Element::IsSelected(Locator::FindFor(findInformation));
146
+ } catch(Exception^ e) {
147
+ Debug::WriteLine("IsSelected: {0}", e->Message);
148
+ return false;
149
+ }
150
+ }
151
+
152
+ __declspec ( dllexport ) bool Click(const FindInformation& findInformation, char* errorInfo, const int errorInfoSize) {
153
+ try {
154
+ return Clicker::Click(Locator::FindFor(findInformation));
155
+ } catch(Exception^ e) {
156
+ if( errorInfo ) {
157
+ StringHelper::CopyToUnmanagedString(e->ToString(), errorInfo, errorInfoSize);
158
+ }
264
159
 
265
- __declspec ( dllexport ) bool IsSelected(const FindInformation& findInformation) {
266
- try {
267
- auto selectionItem = gcnew SelectionItem(findInformation);
268
- return selectionItem->IsSelected;
269
- } catch(Exception^ e) {
270
- Debug::WriteLine("IsSelected: {0}", e->Message);
271
160
  return false;
272
- }
273
- }
274
-
275
- __declspec ( dllexport ) int RA_Select(IUIAutomationElement *pElement) {
276
- ISelectionItemProvider *pSelectionPattern ;
277
- HRESULT hr = pElement->GetCurrentPattern(UIA_SelectionItemPatternId, (IUnknown**)&pSelectionPattern) ;
278
- if (FAILED(hr)) {
279
- printf("RA_GetIsSelected: getCurrentPattern failed 0x%x\r\n") ;
280
- return FALSE ;
281
- }
282
-
283
- hr = pSelectionPattern->Select();
284
- if (FAILED(hr)) {
285
- printf("RA_Select: Select failed 0x%x\r\n", hr) ;
286
- return 0 ;
287
- }
288
-
289
- return 1;
290
- }
291
-
292
- __declspec ( dllexport ) bool RA_Click(const FindInformation& findInformation, char* errorInfo, const int errorInfoSize) {
293
- try {
294
- auto automationClicker = gcnew AutomationClicker(findInformation);
295
- return automationClicker->Click();
296
- } catch(Exception^ e) {
297
- if( errorInfo ) {
298
- StringHelper::CopyToUnmanagedString(e->ToString(), errorInfo, errorInfoSize);
299
- return false;
300
- }
301
- }
302
- }
303
-
304
- __declspec ( dllexport ) void RA_PointAndClick(const HWND windowHandle, char* errorInfo, const int errorInfoSize) {
305
- try {
306
- auto automationClicker = gcnew AutomationClicker(windowHandle);
307
- automationClicker->MouseClick();
308
- } catch(Exception^ e) {
309
- if( errorInfo ) {
310
- StringHelper::CopyToUnmanagedString(e->ToString(), errorInfo, errorInfoSize);
311
- }
312
- }
313
- }
314
-
315
- __declspec ( dllexport ) void RA_ExpandItemByValue(const FindInformation& findInformation, const char* whichItem) {
316
- try {
317
- auto expandCollapseHelper = gcnew ExpandCollapseHelper();
318
- expandCollapseHelper->ExpandByValue(findInformation, whichItem);
319
- } catch(Exception^ e) {
320
- Console::WriteLine(e->ToString());
321
- }
322
- }
323
-
324
- __declspec ( dllexport ) void RA_ExpandItemByIndex(const FindInformation& findInformation, const int whichItemIndex) {
325
- try {
326
- auto expandCollapseHelper = gcnew ExpandCollapseHelper();
327
- expandCollapseHelper->ExpandByIndex(findInformation, whichItemIndex);
328
- } catch(Exception^ e) {
329
- Console::WriteLine(e->ToString());
330
- }
331
- }
332
-
333
- __declspec ( dllexport ) void RA_CollapseItemByValue(const FindInformation& findInformation, const char* whichItem) {
334
- try {
335
- auto expandCollapseHelper = gcnew ExpandCollapseHelper();
336
- expandCollapseHelper->CollapseByValue(findInformation, whichItem);
337
- } catch(Exception^ e) {
338
- Console::WriteLine(e->ToString());
339
- }
340
- }
341
-
342
- __declspec ( dllexport ) void RA_CollapseItemByIndex(const FindInformation& findInformation, const int whichItemIndex) {
343
- try {
344
- auto expandCollapseHelper = gcnew ExpandCollapseHelper();
345
- expandCollapseHelper->CollapseByIndex(findInformation, whichItemIndex);
346
- } catch(Exception^ e) {
347
- Console::WriteLine(e->ToString());
348
- }
349
- }
161
+ }
162
+ }
163
+
164
+ __declspec ( dllexport ) void ExpandItemByValue(const FindInformation& findInformation, const char* whichItem) {
165
+ try {
166
+ auto expander = gcnew Expander(Locator::FindFor(findInformation));
167
+ expander->Expand(gcnew String(whichItem));
168
+ } catch(Exception^ e) {
169
+ Console::WriteLine(e->ToString());
170
+ }
171
+ }
172
+
173
+ __declspec ( dllexport ) void ExpandItemByIndex(const FindInformation& findInformation, const int whichItemIndex) {
174
+ try {
175
+ auto expander = gcnew Expander(Locator::FindFor(findInformation));
176
+ expander->Expand(whichItemIndex);
177
+ } catch(Exception^ e) {
178
+ Console::WriteLine(e->ToString());
179
+ }
180
+ }
181
+
182
+ __declspec ( dllexport ) void CollapseItemByValue(const FindInformation& findInformation, const char* whichItem) {
183
+ try {
184
+ auto collapser = gcnew Collapser(Locator::FindFor(findInformation));
185
+ collapser->Collapse(gcnew String(whichItem));
186
+ } catch(Exception^ e) {
187
+ Console::WriteLine(e->ToString());
188
+ }
189
+ }
190
+
191
+ __declspec ( dllexport ) void CollapseItemByIndex(const FindInformation& findInformation, const int whichItemIndex) {
192
+ try {
193
+ auto collapser = gcnew Collapser(Locator::FindFor(findInformation));
194
+ collapser->Collapse(whichItemIndex);
195
+ } catch(Exception^ e) {
196
+ Console::WriteLine(e->ToString());
197
+ }
198
+ }
350
199
  }