rautomation 0.7.3 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. data/.gitignore +9 -8
  2. data/Gemfile.lock +2 -2
  3. data/History.rdoc +13 -0
  4. data/README.rdoc +3 -2
  5. data/Rakefile +30 -10
  6. data/VERSION +1 -1
  7. data/ext/UiaDll/Release/UiaDll.dll +0 -0
  8. data/ext/UiaDll/UiaDll/AssemblyInfo.cpp +40 -0
  9. data/ext/UiaDll/UiaDll/AutomatedComboBox.cpp +66 -0
  10. data/ext/UiaDll/UiaDll/AutomatedComboBox.h +32 -0
  11. data/ext/UiaDll/UiaDll/AutomatedTable.cpp +50 -0
  12. data/ext/UiaDll/UiaDll/AutomatedTable.h +22 -0
  13. data/ext/UiaDll/UiaDll/AutomationClicker.cpp +50 -0
  14. data/ext/UiaDll/UiaDll/AutomationClicker.h +24 -0
  15. data/ext/UiaDll/UiaDll/ExpandCollapseHelper.cpp +53 -0
  16. data/ext/UiaDll/UiaDll/ExpandCollapseHelper.h +22 -0
  17. data/ext/UiaDll/UiaDll/MenuItemSelector.cpp +75 -0
  18. data/ext/UiaDll/UiaDll/MenuItemSelector.h +22 -0
  19. data/ext/UiaDll/UiaDll/ReadMe.txt +8 -18
  20. data/ext/UiaDll/UiaDll/StringHelper.cpp +9 -0
  21. data/ext/UiaDll/UiaDll/StringHelper.h +7 -0
  22. data/ext/UiaDll/UiaDll/ToggleStateHelper.cpp +33 -0
  23. data/ext/UiaDll/UiaDll/ToggleStateHelper.h +10 -0
  24. data/ext/UiaDll/UiaDll/UiaDll.cpp +458 -325
  25. data/ext/UiaDll/UiaDll/UiaDll.h +13 -0
  26. data/ext/UiaDll/UiaDll/UiaDll.vcxproj +45 -28
  27. data/ext/UiaDll/UiaDll/UiaDll.vcxproj.filters +66 -7
  28. data/ext/UiaDll/UiaDll/app.ico +0 -0
  29. data/ext/UiaDll/UiaDll/app.rc +0 -0
  30. data/ext/UiaDll/UiaDll/dllmain.cpp +5 -23
  31. data/ext/UiaDll/UiaDll/resource.h +3 -0
  32. data/ext/UiaDll/UiaDll/stdafx.cpp +0 -3
  33. data/ext/UiaDll/UiaDll/stdafx.h +23 -18
  34. data/ext/UiaDll/UiaDll.sln +6 -6
  35. data/ext/WindowsForms/Release/WindowsForms.exe +0 -0
  36. data/ext/WindowsForms/{src/WindowsForms/WindowsForms → WindowsForms}/AboutBox.Designer.cs +0 -0
  37. data/ext/WindowsForms/{src/WindowsForms/WindowsForms → WindowsForms}/AboutBox.cs +0 -0
  38. data/ext/WindowsForms/{src/WindowsForms/WindowsForms → WindowsForms}/AboutBox.resx +0 -0
  39. data/ext/WindowsForms/{src/WindowsForms/WindowsForms → WindowsForms}/DataEntryForm.Designer.cs +0 -0
  40. data/ext/WindowsForms/{src/WindowsForms/WindowsForms → WindowsForms}/DataEntryForm.cs +0 -0
  41. data/ext/WindowsForms/{src/WindowsForms/WindowsForms → WindowsForms}/DataEntryForm.resx +0 -0
  42. data/ext/WindowsForms/{src/WindowsForms/WindowsForms → WindowsForms}/MainFormWindow.Designer.cs +173 -76
  43. data/ext/WindowsForms/{src/WindowsForms/WindowsForms → WindowsForms}/MainFormWindow.cs +76 -77
  44. data/ext/WindowsForms/{src/WindowsForms/WindowsForms → WindowsForms}/MainFormWindow.resx +3 -0
  45. data/ext/WindowsForms/{src/WindowsForms/WindowsForms → WindowsForms}/PersonForm.Designer.cs +0 -0
  46. data/ext/WindowsForms/{src/WindowsForms/WindowsForms → WindowsForms}/PersonForm.cs +0 -0
  47. data/ext/WindowsForms/{src/WindowsForms/WindowsForms → WindowsForms}/PersonForm.resx +0 -0
  48. data/ext/WindowsForms/{src/WindowsForms/WindowsForms → WindowsForms}/Program.cs +0 -0
  49. data/ext/WindowsForms/{src/WindowsForms/WindowsForms → WindowsForms}/Properties/AssemblyInfo.cs +0 -0
  50. data/ext/WindowsForms/{src/WindowsForms/WindowsForms → WindowsForms}/Properties/Resources.Designer.cs +0 -0
  51. data/ext/WindowsForms/{src/WindowsForms/WindowsForms → WindowsForms}/Properties/Resources.resx +0 -0
  52. data/ext/WindowsForms/{src/WindowsForms/WindowsForms → WindowsForms}/Properties/Settings.Designer.cs +0 -0
  53. data/ext/WindowsForms/{src/WindowsForms/WindowsForms → WindowsForms}/Properties/Settings.settings +0 -0
  54. data/ext/WindowsForms/{src/WindowsForms/WindowsForms → WindowsForms}/SimpleElementsForm.Designer.cs +0 -0
  55. data/ext/WindowsForms/{src/WindowsForms/WindowsForms → WindowsForms}/SimpleElementsForm.cs +0 -0
  56. data/ext/WindowsForms/{src/WindowsForms/WindowsForms → WindowsForms}/SimpleElementsForm.resx +0 -0
  57. data/ext/WindowsForms/{src/WindowsForms/WindowsForms → WindowsForms}/WindowsForms.csproj +2 -2
  58. data/ext/WindowsForms/{src/WindowsForms/WindowsForms.sln → WindowsForms.sln} +0 -0
  59. data/lib/rautomation/adapter/ms_uia/constants.rb +1 -0
  60. data/lib/rautomation/adapter/ms_uia/control.rb +11 -0
  61. data/lib/rautomation/adapter/ms_uia/functions.rb +8 -5
  62. data/lib/rautomation/adapter/ms_uia/menu.rb +36 -0
  63. data/lib/rautomation/adapter/ms_uia/select_list.rb +4 -12
  64. data/lib/rautomation/adapter/ms_uia/table.rb +90 -11
  65. data/lib/rautomation/adapter/ms_uia/uia_dll.rb +48 -2
  66. data/lib/rautomation/adapter/ms_uia/window.rb +6 -1
  67. data/lib/rautomation/adapter/ms_uia.rb +1 -0
  68. data/spec/adapter/autoit/mouse_spec.rb +2 -2
  69. data/spec/adapter/ms_uia/functions_spec.rb +39 -0
  70. data/spec/adapter/ms_uia/select_list_spec.rb +26 -13
  71. data/spec/adapter/ms_uia/table_spec.rb +96 -2
  72. data/spec/adapter/ms_uia/window_spec.rb +37 -11
  73. data/spec/adapter/win_32/mouse_spec.rb +2 -2
  74. data/spec/adapter/win_32/window_spec.rb +0 -9
  75. data/spec/spec_helper.rb +3 -3
  76. data/spec/window_spec.rb +17 -6
  77. metadata +48 -40
  78. data/ext/ListViewExplorer/ListViewExplorer/ListViewExplorer.cpp +0 -174
  79. data/ext/ListViewExplorer/ListViewExplorer/ListViewExplorer.vcxproj +0 -95
  80. data/ext/ListViewExplorer/ListViewExplorer/ListViewExplorer.vcxproj.filters +0 -42
  81. data/ext/ListViewExplorer/ListViewExplorer/ListViewExplorer.vcxproj.user +0 -3
  82. data/ext/ListViewExplorer/ListViewExplorer/ReadMe.txt +0 -40
  83. data/ext/ListViewExplorer/ListViewExplorer/stdafx.cpp +0 -8
  84. data/ext/ListViewExplorer/ListViewExplorer/stdafx.h +0 -17
  85. data/ext/ListViewExplorer/ListViewExplorer/table_support.cpp +0 -250
  86. data/ext/ListViewExplorer/ListViewExplorer/table_support.h +0 -2
  87. data/ext/ListViewExplorer/ListViewExplorer/targetver.h +0 -8
  88. data/ext/ListViewExplorer/ListViewExplorer.sln +0 -20
  89. data/ext/ListViewExplorer/ListViewExplorer.suo +0 -0
  90. data/ext/UiaDll/UiaDll.suo +0 -0
  91. data/ext/WindowsForms/bin/WindowsForms.exe +0 -0
  92. data/ext/WindowsForms/src/WindowsForms/WindowsForms.suo +0 -0
data/spec/window_spec.rb CHANGED
@@ -1,19 +1,19 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe RAutomation::Window do
4
- it "RAutomation::Window.adapter" do
4
+ it ".adapter" do
5
5
  RAutomation::Window.new(:title => "random").adapter.should == (ENV["RAUTOMATION_ADAPTER"] && ENV["RAUTOMATION_ADAPTER"].to_sym || RAutomation::Adapter::Helper.default_adapter)
6
6
  end
7
7
 
8
- it "Window#new by full title" do
8
+ it "#new by full title" do
9
9
  RAutomation::Window.new(:title => SpecHelper::DATA[:window1_full_title]).should exist
10
10
  end
11
11
 
12
- it "Window#new by regexp title" do
12
+ it "#new by regexp title" do
13
13
  RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title]).should exist
14
14
  end
15
15
 
16
- it "Window#new by hwnd" do
16
+ it "#new by hwnd" do
17
17
  hwnd = RAutomation::Window.new(:title => SpecHelper::DATA[:window1_full_title]).hwnd
18
18
  window = RAutomation::Window.new(:hwnd => hwnd)
19
19
  window.should exist
@@ -53,10 +53,10 @@ describe RAutomation::Window do
53
53
 
54
54
  it "#class_names" do
55
55
  window = RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title])
56
- window.class_names.size.should == 24
57
56
 
58
57
  fail "Expected class name not found." unless window.class_names.include?("WindowsForms10.Window.8.app.0.2bf8098_r15_ad1") or
59
- window.class_names.include?("WindowsForms10.Window.8.app.0.2bf8098_r16_ad1")
58
+ window.class_names.include?("WindowsForms10.Window.8.app.0.2bf8098_r16_ad1") or
59
+ window.class_names.include?("WindowsForms10.Window.8.app.0.2bf8098_r11_ad1")
60
60
 
61
61
  RAutomation::Window.wait_timeout = 0.1
62
62
  expect {RAutomation::Window.new(:title => "non-existing-window").class_names}.
@@ -131,4 +131,15 @@ describe RAutomation::Window do
131
131
  expect {RAutomation::Window.new(:title => "non-existing-window").close}.
132
132
  to_not raise_exception
133
133
  end
134
+
135
+ it "#child", :if => [:win_32, :ms_uia].include?(SpecHelper.adapter) do
136
+ window = RAutomation::Window.new(:title => SpecHelper::DATA[:window1_full_title])
137
+ window.should exist
138
+
139
+ # buttons are windows too. so let's find the button for now
140
+ child = window.child(:title => /About/i)
141
+ child.should exist
142
+ child.title.should == "&About"
143
+ child.adapter.should == SpecHelper.adapter
144
+ end
134
145
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rautomation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.3
4
+ version: 0.8.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-31 00:00:00.000000000 Z
12
+ date: 2012-12-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ffi
@@ -111,55 +111,60 @@ files:
111
111
  - ext/IAccessibleDLL/IAccessibleDLL/table_support.cpp
112
112
  - ext/IAccessibleDLL/IAccessibleDLL/targetver.h
113
113
  - ext/IAccessibleDLL/Release/IAccessibleDLL.dll
114
- - ext/ListViewExplorer/ListViewExplorer.sln
115
- - ext/ListViewExplorer/ListViewExplorer.suo
116
- - ext/ListViewExplorer/ListViewExplorer/ListViewExplorer.cpp
117
- - ext/ListViewExplorer/ListViewExplorer/ListViewExplorer.vcxproj
118
- - ext/ListViewExplorer/ListViewExplorer/ListViewExplorer.vcxproj.filters
119
- - ext/ListViewExplorer/ListViewExplorer/ListViewExplorer.vcxproj.user
120
- - ext/ListViewExplorer/ListViewExplorer/ReadMe.txt
121
- - ext/ListViewExplorer/ListViewExplorer/stdafx.cpp
122
- - ext/ListViewExplorer/ListViewExplorer/stdafx.h
123
- - ext/ListViewExplorer/ListViewExplorer/table_support.cpp
124
- - ext/ListViewExplorer/ListViewExplorer/table_support.h
125
- - ext/ListViewExplorer/ListViewExplorer/targetver.h
126
114
  - ext/UiaDll/Release/UiaDll.dll
127
115
  - ext/UiaDll/UiaDll.sln
128
- - ext/UiaDll/UiaDll.suo
116
+ - ext/UiaDll/UiaDll/AssemblyInfo.cpp
117
+ - ext/UiaDll/UiaDll/AutomatedComboBox.cpp
118
+ - ext/UiaDll/UiaDll/AutomatedComboBox.h
119
+ - ext/UiaDll/UiaDll/AutomatedTable.cpp
120
+ - ext/UiaDll/UiaDll/AutomatedTable.h
121
+ - ext/UiaDll/UiaDll/AutomationClicker.cpp
122
+ - ext/UiaDll/UiaDll/AutomationClicker.h
123
+ - ext/UiaDll/UiaDll/ExpandCollapseHelper.cpp
124
+ - ext/UiaDll/UiaDll/ExpandCollapseHelper.h
125
+ - ext/UiaDll/UiaDll/MenuItemSelector.cpp
126
+ - ext/UiaDll/UiaDll/MenuItemSelector.h
129
127
  - ext/UiaDll/UiaDll/ReadMe.txt
128
+ - ext/UiaDll/UiaDll/StringHelper.cpp
129
+ - ext/UiaDll/UiaDll/StringHelper.h
130
+ - ext/UiaDll/UiaDll/ToggleStateHelper.cpp
131
+ - ext/UiaDll/UiaDll/ToggleStateHelper.h
130
132
  - ext/UiaDll/UiaDll/UiaDll.cpp
133
+ - ext/UiaDll/UiaDll/UiaDll.h
131
134
  - ext/UiaDll/UiaDll/UiaDll.vcxproj
132
135
  - ext/UiaDll/UiaDll/UiaDll.vcxproj.filters
136
+ - ext/UiaDll/UiaDll/app.ico
137
+ - ext/UiaDll/UiaDll/app.rc
133
138
  - ext/UiaDll/UiaDll/dllmain.cpp
134
139
  - ext/UiaDll/UiaDll/globals.h
140
+ - ext/UiaDll/UiaDll/resource.h
135
141
  - ext/UiaDll/UiaDll/stdafx.cpp
136
142
  - ext/UiaDll/UiaDll/stdafx.h
137
143
  - ext/UiaDll/UiaDll/targetver.h
138
- - ext/WindowsForms/bin/WindowsForms.exe
139
- - ext/WindowsForms/src/WindowsForms/WindowsForms.sln
140
- - ext/WindowsForms/src/WindowsForms/WindowsForms.suo
141
- - ext/WindowsForms/src/WindowsForms/WindowsForms/AboutBox.Designer.cs
142
- - ext/WindowsForms/src/WindowsForms/WindowsForms/AboutBox.cs
143
- - ext/WindowsForms/src/WindowsForms/WindowsForms/AboutBox.resx
144
- - ext/WindowsForms/src/WindowsForms/WindowsForms/DataEntryForm.Designer.cs
145
- - ext/WindowsForms/src/WindowsForms/WindowsForms/DataEntryForm.cs
146
- - ext/WindowsForms/src/WindowsForms/WindowsForms/DataEntryForm.resx
147
- - ext/WindowsForms/src/WindowsForms/WindowsForms/MainFormWindow.Designer.cs
148
- - ext/WindowsForms/src/WindowsForms/WindowsForms/MainFormWindow.cs
149
- - ext/WindowsForms/src/WindowsForms/WindowsForms/MainFormWindow.resx
150
- - ext/WindowsForms/src/WindowsForms/WindowsForms/PersonForm.Designer.cs
151
- - ext/WindowsForms/src/WindowsForms/WindowsForms/PersonForm.cs
152
- - ext/WindowsForms/src/WindowsForms/WindowsForms/PersonForm.resx
153
- - ext/WindowsForms/src/WindowsForms/WindowsForms/Program.cs
154
- - ext/WindowsForms/src/WindowsForms/WindowsForms/Properties/AssemblyInfo.cs
155
- - ext/WindowsForms/src/WindowsForms/WindowsForms/Properties/Resources.Designer.cs
156
- - ext/WindowsForms/src/WindowsForms/WindowsForms/Properties/Resources.resx
157
- - ext/WindowsForms/src/WindowsForms/WindowsForms/Properties/Settings.Designer.cs
158
- - ext/WindowsForms/src/WindowsForms/WindowsForms/Properties/Settings.settings
159
- - ext/WindowsForms/src/WindowsForms/WindowsForms/SimpleElementsForm.Designer.cs
160
- - ext/WindowsForms/src/WindowsForms/WindowsForms/SimpleElementsForm.cs
161
- - ext/WindowsForms/src/WindowsForms/WindowsForms/SimpleElementsForm.resx
162
- - ext/WindowsForms/src/WindowsForms/WindowsForms/WindowsForms.csproj
144
+ - ext/WindowsForms/Release/WindowsForms.exe
145
+ - ext/WindowsForms/WindowsForms.sln
146
+ - ext/WindowsForms/WindowsForms/AboutBox.Designer.cs
147
+ - ext/WindowsForms/WindowsForms/AboutBox.cs
148
+ - ext/WindowsForms/WindowsForms/AboutBox.resx
149
+ - ext/WindowsForms/WindowsForms/DataEntryForm.Designer.cs
150
+ - ext/WindowsForms/WindowsForms/DataEntryForm.cs
151
+ - ext/WindowsForms/WindowsForms/DataEntryForm.resx
152
+ - ext/WindowsForms/WindowsForms/MainFormWindow.Designer.cs
153
+ - ext/WindowsForms/WindowsForms/MainFormWindow.cs
154
+ - ext/WindowsForms/WindowsForms/MainFormWindow.resx
155
+ - ext/WindowsForms/WindowsForms/PersonForm.Designer.cs
156
+ - ext/WindowsForms/WindowsForms/PersonForm.cs
157
+ - ext/WindowsForms/WindowsForms/PersonForm.resx
158
+ - ext/WindowsForms/WindowsForms/Program.cs
159
+ - ext/WindowsForms/WindowsForms/Properties/AssemblyInfo.cs
160
+ - ext/WindowsForms/WindowsForms/Properties/Resources.Designer.cs
161
+ - ext/WindowsForms/WindowsForms/Properties/Resources.resx
162
+ - ext/WindowsForms/WindowsForms/Properties/Settings.Designer.cs
163
+ - ext/WindowsForms/WindowsForms/Properties/Settings.settings
164
+ - ext/WindowsForms/WindowsForms/SimpleElementsForm.Designer.cs
165
+ - ext/WindowsForms/WindowsForms/SimpleElementsForm.cs
166
+ - ext/WindowsForms/WindowsForms/SimpleElementsForm.resx
167
+ - ext/WindowsForms/WindowsForms/WindowsForms.csproj
163
168
  - lib/rautomation.rb
164
169
  - lib/rautomation/adapter/autoit.rb
165
170
  - lib/rautomation/adapter/autoit/button.rb
@@ -181,6 +186,7 @@ files:
181
186
  - lib/rautomation/adapter/ms_uia/list_box.rb
182
187
  - lib/rautomation/adapter/ms_uia/list_item.rb
183
188
  - lib/rautomation/adapter/ms_uia/locators.rb
189
+ - lib/rautomation/adapter/ms_uia/menu.rb
184
190
  - lib/rautomation/adapter/ms_uia/radio.rb
185
191
  - lib/rautomation/adapter/ms_uia/select_list.rb
186
192
  - lib/rautomation/adapter/ms_uia/table.rb
@@ -216,6 +222,7 @@ files:
216
222
  - spec/adapter/ms_uia/button_spec.rb
217
223
  - spec/adapter/ms_uia/checkbox_spec.rb
218
224
  - spec/adapter/ms_uia/control_spec.rb
225
+ - spec/adapter/ms_uia/functions_spec.rb
219
226
  - spec/adapter/ms_uia/keystroke_converter_spec.rb
220
227
  - spec/adapter/ms_uia/label_spec.rb
221
228
  - spec/adapter/ms_uia/list_item_spec.rb
@@ -272,6 +279,7 @@ test_files:
272
279
  - spec/adapter/ms_uia/button_spec.rb
273
280
  - spec/adapter/ms_uia/checkbox_spec.rb
274
281
  - spec/adapter/ms_uia/control_spec.rb
282
+ - spec/adapter/ms_uia/functions_spec.rb
275
283
  - spec/adapter/ms_uia/keystroke_converter_spec.rb
276
284
  - spec/adapter/ms_uia/label_spec.rb
277
285
  - spec/adapter/ms_uia/list_item_spec.rb
@@ -1,174 +0,0 @@
1
- // ListViewExplorer.cpp : Defines the entry point for the console application.
2
- //
3
-
4
- #include "stdafx.h"
5
-
6
- HWND ask_for_list_view_handle() {
7
- HWND hwnd = 0 ;
8
-
9
- printf("HWND of list view control: ") ;
10
- scanf_s("%x", &hwnd) ;
11
- while(getchar() != '\n') continue;
12
-
13
- return hwnd ;
14
- }
15
-
16
- void print_acc_name(VARIANT varIn, IAccessible *pAccessible) {
17
- BSTR bstrName ;
18
-
19
- if (pAccessible->get_accName(varIn, &bstrName) == S_OK) {
20
- char *pszName = _com_util::ConvertBSTRToString(bstrName) ;
21
- printf(" Name: %s\r\n", pszName) ;
22
- delete[] pszName ;
23
- SysFreeString(bstrName) ;
24
- } else
25
- printf(" Name: not available\r\n") ;
26
- }
27
-
28
- void print_acc_value(VARIANT varIn, IAccessible *pAccessible) {
29
- BSTR bstrValue ;
30
-
31
- if (pAccessible->get_accValue(varIn, &bstrValue) == S_OK) {
32
- char *pszValue = _com_util::ConvertBSTRToString(bstrValue) ;
33
- printf(" Value: %s\r\n", pszValue) ;
34
- delete[] pszValue ;
35
- SysFreeString(bstrValue) ;
36
- } else
37
- printf(" Value: not available\r\n") ;
38
- }
39
-
40
- void print_acc_description(VARIANT varIn, IAccessible *pAccessible) {
41
- BSTR bstrValue ;
42
-
43
- if (pAccessible->get_accDescription(varIn, &bstrValue) == S_OK) {
44
- char *pszValue = _com_util::ConvertBSTRToString(bstrValue) ;
45
- printf(" Description: %s\r\n", pszValue) ;
46
- delete[] pszValue ;
47
- SysFreeString(bstrValue) ;
48
- } else
49
- printf(" Description: not available\r\n") ;
50
- }
51
-
52
- void print_acc_child_count(IAccessible *pAccessible) {
53
- long count ;
54
- pAccessible->get_accChildCount(&count) ;
55
- printf(" Number of childs: %d\r\n", count) ;
56
- }
57
-
58
- void print_acc_role(VARIANT varIn, IAccessible *pAccessible) {
59
- VARIANT varOut ;
60
- VariantInit(&varOut) ;
61
- varOut.vt = VT_I4 ;
62
-
63
- pAccessible->get_accRole(varIn, &varOut) ;
64
-
65
- int roleTextMax = 255 ;
66
- LPTSTR pRoleText = new TCHAR[roleTextMax] ;
67
- GetRoleText(varOut.lVal, pRoleText, roleTextMax) ;
68
-
69
- int lenSzRoleText = 255 ;
70
- char *pszRoleText = new char[lenSzRoleText] ;
71
- WideCharToMultiByte(CP_ACP, 0, pRoleText, wcslen(pRoleText) + 1, pszRoleText, lenSzRoleText, NULL, NULL) ;
72
-
73
- printf(" Role is %s\r\n", pszRoleText) ;
74
- }
75
-
76
- void print_properties(IAccessible *pAccessible, long childId) {
77
- VARIANT varChild ;
78
- VariantInit(&varChild) ;
79
- varChild.vt = VT_I4 ;
80
- varChild.lVal = childId ;
81
-
82
- print_acc_name(varChild, pAccessible) ;
83
- print_acc_value(varChild, pAccessible) ;
84
- print_acc_role(varChild, pAccessible) ;
85
- print_acc_description(varChild, pAccessible) ;
86
-
87
- if (childId == CHILDID_SELF)
88
- print_acc_child_count(pAccessible) ;
89
- }
90
-
91
- void iterate_over_childs(IAccessible *pAccessible) {
92
- printf("Iterating over childs\r\n") ;
93
-
94
- long childCount ;
95
- pAccessible->get_accChildCount(&childCount) ;
96
-
97
- for (int childId = 1; childId <= childCount; childId++) {
98
- printf("Child number %d: ", childId) ;
99
- VARIANT varChild ;
100
- VariantInit(&varChild) ;
101
- varChild.vt = VT_I4 ;
102
- varChild.lVal = childId ;
103
-
104
- IDispatch *pIDispatch ;
105
- HRESULT hr = pAccessible->get_accChild(varChild, &pIDispatch) ;
106
- if (hr == S_OK) {
107
- printf("get_accChild returned S_OK. Now asking for IDispatch") ;
108
- IAccessible *pChildIAccessible ;
109
- pIDispatch->QueryInterface(IID_IAccessible, (void**)&pChildIAccessible) ;
110
- print_properties(pChildIAccessible, CHILDID_SELF) ;
111
- } else if (hr == S_FALSE) {
112
- printf("Simple element\r\n") ;
113
- print_properties(pAccessible, childId) ;
114
- } else if (hr == E_INVALIDARG)
115
- printf("Invalid argument\r\n") ;
116
- else
117
- printf("getAccChild returned %x\r\n", hr) ;
118
- }
119
- }
120
-
121
- int _tmain(int argc, _TCHAR* argv[])
122
- {
123
- printf("ListView Explorer\r\n") ;
124
-
125
- HWND hwndListView = ask_for_list_view_handle() ;
126
-
127
- HMODULE hModule = LoadLibraryA("oleacc.dll");
128
- if (hModule == 0) {
129
- printf("Cannot load oleacc.dll\r\n") ;
130
- return 1 ;
131
- }
132
-
133
- long numberOfRows ;
134
- long numberOfColumns ;
135
- char ***tableStrings ;
136
-
137
- get_table_strings(hModule, hwndListView, (char **)&tableStrings, &numberOfRows, &numberOfColumns) ;
138
-
139
- printf("Now printing result\r\n") ;
140
- for (int row = 0; row < numberOfRows; row++) {
141
- for (int column = 0; column < numberOfColumns; column++) {
142
- printf("row %d, col %d is '%s'\r\n", row, column, tableStrings[row][column]) ;
143
- free(tableStrings[row][column]) ;
144
- }
145
- free(tableStrings[row]) ;
146
- }
147
-
148
-
149
- /*
150
- printf("ListView Explorer\r\n") ;
151
-
152
- HWND hwndListView = ask_for_list_view_handle() ;
153
- IAccessible *pAccessible ;
154
- LPFNACCESSIBLEOBJECTFROMWINDOW lpfnAccessibleObjectFromWindow ;
155
-
156
- HMODULE hModule = LoadLibraryA("oleacc.dll");
157
- if (hModule == 0) {
158
- printf("Cannot load oleacc.dll\r\n") ;
159
- return 1 ;
160
- }
161
-
162
- lpfnAccessibleObjectFromWindow = (LPFNACCESSIBLEOBJECTFROMWINDOW)GetProcAddress(hModule, "AccessibleObjectFromWindow");
163
-
164
- if (HRESULT hResult = lpfnAccessibleObjectFromWindow(hwndListView, OBJID_CLIENT, IID_IAccessible, (void**)&pAccessible) == S_OK) {
165
- printf("Got IAccessible\r\n") ;
166
- print_properties(pAccessible, CHILDID_SELF) ;
167
- iterate_over_childs(pAccessible) ;
168
- } else
169
- printf("Cannot retrieve IAccessible for window HWND %x. AccessibleObjectFromWindow returned %x\r\n", hwndListView, hResult) ;
170
- */
171
-
172
- return 0;
173
- }
174
-
@@ -1,95 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
- <ItemGroup Label="ProjectConfigurations">
4
- <ProjectConfiguration Include="Debug|Win32">
5
- <Configuration>Debug</Configuration>
6
- <Platform>Win32</Platform>
7
- </ProjectConfiguration>
8
- <ProjectConfiguration Include="Release|Win32">
9
- <Configuration>Release</Configuration>
10
- <Platform>Win32</Platform>
11
- </ProjectConfiguration>
12
- </ItemGroup>
13
- <PropertyGroup Label="Globals">
14
- <ProjectGuid>{EF611F7A-863F-4062-AAD2-84D150F4D7C0}</ProjectGuid>
15
- <Keyword>Win32Proj</Keyword>
16
- <RootNamespace>ListViewExplorer</RootNamespace>
17
- </PropertyGroup>
18
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
19
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
20
- <ConfigurationType>Application</ConfigurationType>
21
- <UseDebugLibraries>true</UseDebugLibraries>
22
- <CharacterSet>Unicode</CharacterSet>
23
- </PropertyGroup>
24
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
25
- <ConfigurationType>Application</ConfigurationType>
26
- <UseDebugLibraries>false</UseDebugLibraries>
27
- <WholeProgramOptimization>true</WholeProgramOptimization>
28
- <CharacterSet>Unicode</CharacterSet>
29
- </PropertyGroup>
30
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
31
- <ImportGroup Label="ExtensionSettings">
32
- </ImportGroup>
33
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
34
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
35
- </ImportGroup>
36
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
37
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
38
- </ImportGroup>
39
- <PropertyGroup Label="UserMacros" />
40
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
41
- <LinkIncremental>true</LinkIncremental>
42
- </PropertyGroup>
43
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
44
- <LinkIncremental>false</LinkIncremental>
45
- </PropertyGroup>
46
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
47
- <ClCompile>
48
- <PrecompiledHeader>Use</PrecompiledHeader>
49
- <WarningLevel>Level3</WarningLevel>
50
- <Optimization>Disabled</Optimization>
51
- <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
52
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
53
- </ClCompile>
54
- <Link>
55
- <SubSystem>Console</SubSystem>
56
- <GenerateDebugInformation>true</GenerateDebugInformation>
57
- <AdditionalDependencies>oleacc.lib;comsuppw.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
58
- </Link>
59
- </ItemDefinitionGroup>
60
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
61
- <ClCompile>
62
- <WarningLevel>Level3</WarningLevel>
63
- <PrecompiledHeader>Use</PrecompiledHeader>
64
- <Optimization>MaxSpeed</Optimization>
65
- <FunctionLevelLinking>true</FunctionLevelLinking>
66
- <IntrinsicFunctions>true</IntrinsicFunctions>
67
- <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
68
- </ClCompile>
69
- <Link>
70
- <SubSystem>Console</SubSystem>
71
- <GenerateDebugInformation>true</GenerateDebugInformation>
72
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
73
- <OptimizeReferences>true</OptimizeReferences>
74
- </Link>
75
- </ItemDefinitionGroup>
76
- <ItemGroup>
77
- <None Include="ReadMe.txt" />
78
- </ItemGroup>
79
- <ItemGroup>
80
- <ClInclude Include="stdafx.h" />
81
- <ClInclude Include="table_support.h" />
82
- <ClInclude Include="targetver.h" />
83
- </ItemGroup>
84
- <ItemGroup>
85
- <ClCompile Include="ListViewExplorer.cpp" />
86
- <ClCompile Include="stdafx.cpp">
87
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
88
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
89
- </ClCompile>
90
- <ClCompile Include="table_support.cpp" />
91
- </ItemGroup>
92
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
93
- <ImportGroup Label="ExtensionTargets">
94
- </ImportGroup>
95
- </Project>
@@ -1,42 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
- <ItemGroup>
4
- <Filter Include="Source Files">
5
- <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
6
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
7
- </Filter>
8
- <Filter Include="Header Files">
9
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
10
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
11
- </Filter>
12
- <Filter Include="Resource Files">
13
- <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
14
- <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
15
- </Filter>
16
- </ItemGroup>
17
- <ItemGroup>
18
- <None Include="ReadMe.txt" />
19
- </ItemGroup>
20
- <ItemGroup>
21
- <ClInclude Include="stdafx.h">
22
- <Filter>Header Files</Filter>
23
- </ClInclude>
24
- <ClInclude Include="targetver.h">
25
- <Filter>Header Files</Filter>
26
- </ClInclude>
27
- <ClInclude Include="table_support.h">
28
- <Filter>Header Files</Filter>
29
- </ClInclude>
30
- </ItemGroup>
31
- <ItemGroup>
32
- <ClCompile Include="stdafx.cpp">
33
- <Filter>Source Files</Filter>
34
- </ClCompile>
35
- <ClCompile Include="ListViewExplorer.cpp">
36
- <Filter>Source Files</Filter>
37
- </ClCompile>
38
- <ClCompile Include="table_support.cpp">
39
- <Filter>Source Files</Filter>
40
- </ClCompile>
41
- </ItemGroup>
42
- </Project>
@@ -1,3 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
- </Project>
@@ -1,40 +0,0 @@
1
- ========================================================================
2
- CONSOLE APPLICATION : ListViewExplorer Project Overview
3
- ========================================================================
4
-
5
- AppWizard has created this ListViewExplorer application for you.
6
-
7
- This file contains a summary of what you will find in each of the files that
8
- make up your ListViewExplorer application.
9
-
10
-
11
- ListViewExplorer.vcxproj
12
- This is the main project file for VC++ projects generated using an Application Wizard.
13
- It contains information about the version of Visual C++ that generated the file, and
14
- information about the platforms, configurations, and project features selected with the
15
- Application Wizard.
16
-
17
- ListViewExplorer.vcxproj.filters
18
- This is the filters file for VC++ projects generated using an Application Wizard.
19
- It contains information about the association between the files in your project
20
- and the filters. This association is used in the IDE to show grouping of files with
21
- similar extensions under a specific node (for e.g. ".cpp" files are associated with the
22
- "Source Files" filter).
23
-
24
- ListViewExplorer.cpp
25
- This is the main application source file.
26
-
27
- /////////////////////////////////////////////////////////////////////////////
28
- Other standard files:
29
-
30
- StdAfx.h, StdAfx.cpp
31
- These files are used to build a precompiled header (PCH) file
32
- named ListViewExplorer.pch and a precompiled types file named StdAfx.obj.
33
-
34
- /////////////////////////////////////////////////////////////////////////////
35
- Other notes:
36
-
37
- AppWizard uses "TODO:" comments to indicate parts of the source code you
38
- should add to or customize.
39
-
40
- /////////////////////////////////////////////////////////////////////////////
@@ -1,8 +0,0 @@
1
- // stdafx.cpp : source file that includes just the standard includes
2
- // ListViewExplorer.pch will be the pre-compiled header
3
- // stdafx.obj will contain the pre-compiled type information
4
-
5
- #include "stdafx.h"
6
-
7
- // TODO: reference any additional headers you need in STDAFX.H
8
- // and not in this file
@@ -1,17 +0,0 @@
1
- // stdafx.h : include file for standard system include files,
2
- // or project specific include files that are used frequently, but
3
- // are changed infrequently
4
- //
5
-
6
- #pragma once
7
-
8
- #include "targetver.h"
9
-
10
- #include <stdio.h>
11
- #include <tchar.h>
12
-
13
- #include <Windows.h>
14
- #include <OleAcc.h>
15
- #include <comutil.h>
16
-
17
- #include "table_support.h"