rdp-rautomation 0.6.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. data/.document +5 -0
  2. data/.rspec +2 -0
  3. data/.yardopts +6 -0
  4. data/History.rdoc +103 -0
  5. data/LICENSE +20 -0
  6. data/README.rdoc +114 -0
  7. data/Rakefile +43 -0
  8. data/VERSION +1 -0
  9. data/ext/AutoItX/AutoItX.chm +0 -0
  10. data/ext/AutoItX/AutoItX3.dll +0 -0
  11. data/ext/IAccessibleDLL/IAccessibleDLL.sln +20 -0
  12. data/ext/IAccessibleDLL/IAccessibleDLL.suo +0 -0
  13. data/ext/IAccessibleDLL/IAccessibleDLL/IAccessibleDLL.cpp +30 -0
  14. data/ext/IAccessibleDLL/IAccessibleDLL/IAccessibleDLL.vcxproj +102 -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/Release/IAccessibleDLL.dll +0 -0
  24. data/ext/ListViewExplorer/ListViewExplorer.sln +20 -0
  25. data/ext/ListViewExplorer/ListViewExplorer.suo +0 -0
  26. data/ext/ListViewExplorer/ListViewExplorer/ListViewExplorer.cpp +174 -0
  27. data/ext/ListViewExplorer/ListViewExplorer/ListViewExplorer.vcxproj +95 -0
  28. data/ext/ListViewExplorer/ListViewExplorer/ListViewExplorer.vcxproj.filters +42 -0
  29. data/ext/ListViewExplorer/ListViewExplorer/ListViewExplorer.vcxproj.user +3 -0
  30. data/ext/ListViewExplorer/ListViewExplorer/ReadMe.txt +40 -0
  31. data/ext/ListViewExplorer/ListViewExplorer/stdafx.cpp +8 -0
  32. data/ext/ListViewExplorer/ListViewExplorer/stdafx.h +17 -0
  33. data/ext/ListViewExplorer/ListViewExplorer/table_support.cpp +250 -0
  34. data/ext/ListViewExplorer/ListViewExplorer/table_support.h +2 -0
  35. data/ext/ListViewExplorer/ListViewExplorer/targetver.h +8 -0
  36. data/ext/UiaDll/Release/UiaDll.dll +0 -0
  37. data/ext/UiaDll/UiaDll.sln +20 -0
  38. data/ext/UiaDll/UiaDll.suo +0 -0
  39. data/ext/UiaDll/UiaDll/ReadMe.txt +48 -0
  40. data/ext/UiaDll/UiaDll/UiaDll.cpp +205 -0
  41. data/ext/UiaDll/UiaDll/UiaDll.vcxproj +104 -0
  42. data/ext/UiaDll/UiaDll/UiaDll.vcxproj.filters +42 -0
  43. data/ext/UiaDll/UiaDll/dllmain.cpp +39 -0
  44. data/ext/UiaDll/UiaDll/globals.h +3 -0
  45. data/ext/UiaDll/UiaDll/stdafx.cpp +8 -0
  46. data/ext/UiaDll/UiaDll/stdafx.h +19 -0
  47. data/ext/UiaDll/UiaDll/targetver.h +8 -0
  48. data/ext/WindowsForms/bin/WindowsForms.exe +0 -0
  49. data/ext/WindowsForms/src/WindowsForms/WindowsForms.sln +20 -0
  50. data/ext/WindowsForms/src/WindowsForms/WindowsForms.suo +0 -0
  51. data/ext/WindowsForms/src/WindowsForms/WindowsForms/AboutBox.Designer.cs +80 -0
  52. data/ext/WindowsForms/src/WindowsForms/WindowsForms/AboutBox.cs +103 -0
  53. data/ext/WindowsForms/src/WindowsForms/WindowsForms/AboutBox.resx +120 -0
  54. data/ext/WindowsForms/src/WindowsForms/WindowsForms/DataEntryForm.Designer.cs +187 -0
  55. data/ext/WindowsForms/src/WindowsForms/WindowsForms/DataEntryForm.cs +46 -0
  56. data/ext/WindowsForms/src/WindowsForms/WindowsForms/DataEntryForm.resx +120 -0
  57. data/ext/WindowsForms/src/WindowsForms/WindowsForms/MainFormWindow.Designer.cs +377 -0
  58. data/ext/WindowsForms/src/WindowsForms/WindowsForms/MainFormWindow.cs +78 -0
  59. data/ext/WindowsForms/src/WindowsForms/WindowsForms/MainFormWindow.resx +120 -0
  60. data/ext/WindowsForms/src/WindowsForms/WindowsForms/PersonForm.Designer.cs +119 -0
  61. data/ext/WindowsForms/src/WindowsForms/WindowsForms/PersonForm.cs +34 -0
  62. data/ext/WindowsForms/src/WindowsForms/WindowsForms/PersonForm.resx +120 -0
  63. data/ext/WindowsForms/src/WindowsForms/WindowsForms/Program.cs +21 -0
  64. data/ext/WindowsForms/src/WindowsForms/WindowsForms/Properties/AssemblyInfo.cs +36 -0
  65. data/ext/WindowsForms/src/WindowsForms/WindowsForms/Properties/Resources.Designer.cs +71 -0
  66. data/ext/WindowsForms/src/WindowsForms/WindowsForms/Properties/Resources.resx +117 -0
  67. data/ext/WindowsForms/src/WindowsForms/WindowsForms/Properties/Settings.Designer.cs +30 -0
  68. data/ext/WindowsForms/src/WindowsForms/WindowsForms/Properties/Settings.settings +7 -0
  69. data/ext/WindowsForms/src/WindowsForms/WindowsForms/SimpleElementsForm.Designer.cs +93 -0
  70. data/ext/WindowsForms/src/WindowsForms/WindowsForms/SimpleElementsForm.cs +19 -0
  71. data/ext/WindowsForms/src/WindowsForms/WindowsForms/SimpleElementsForm.resx +120 -0
  72. data/ext/WindowsForms/src/WindowsForms/WindowsForms/WindowsForms.csproj +123 -0
  73. data/ext/WindowsForms/src/WindowsForms/WindowsForms/bin/Release/WindowsForms.exe +0 -0
  74. data/lib/rautomation.rb +6 -0
  75. data/lib/rautomation/adapter/autoit.rb +5 -0
  76. data/lib/rautomation/adapter/autoit/button.rb +59 -0
  77. data/lib/rautomation/adapter/autoit/locators.rb +22 -0
  78. data/lib/rautomation/adapter/autoit/text_field.rb +61 -0
  79. data/lib/rautomation/adapter/autoit/window.rb +184 -0
  80. data/lib/rautomation/adapter/helper.rb +20 -0
  81. data/lib/rautomation/adapter/win_ffi.rb +21 -0
  82. data/lib/rautomation/adapter/win_ffi/button.rb +25 -0
  83. data/lib/rautomation/adapter/win_ffi/button_helper.rb +24 -0
  84. data/lib/rautomation/adapter/win_ffi/checkbox.rb +19 -0
  85. data/lib/rautomation/adapter/win_ffi/constants.rb +94 -0
  86. data/lib/rautomation/adapter/win_ffi/control.rb +79 -0
  87. data/lib/rautomation/adapter/win_ffi/functions.rb +333 -0
  88. data/lib/rautomation/adapter/win_ffi/keystroke_converter.rb +67 -0
  89. data/lib/rautomation/adapter/win_ffi/label.rb +21 -0
  90. data/lib/rautomation/adapter/win_ffi/list_box.rb +60 -0
  91. data/lib/rautomation/adapter/win_ffi/locators.rb +22 -0
  92. data/lib/rautomation/adapter/win_ffi/ms_uia/uia_dll.rb +36 -0
  93. data/lib/rautomation/adapter/win_ffi/radio.rb +19 -0
  94. data/lib/rautomation/adapter/win_ffi/select_list.rb +87 -0
  95. data/lib/rautomation/adapter/win_ffi/table.rb +57 -0
  96. data/lib/rautomation/adapter/win_ffi/text_field.rb +52 -0
  97. data/lib/rautomation/adapter/win_ffi/window.rb +226 -0
  98. data/lib/rautomation/button.rb +55 -0
  99. data/lib/rautomation/element_collections.rb +47 -0
  100. data/lib/rautomation/text_field.rb +60 -0
  101. data/lib/rautomation/wait_helper.rb +23 -0
  102. data/lib/rautomation/window.rb +234 -0
  103. data/spec/adapter/win_ffi/button_spec.rb +41 -0
  104. data/spec/adapter/win_ffi/checkbox_spec.rb +48 -0
  105. data/spec/adapter/win_ffi/keystroke_converter_spec.rb +47 -0
  106. data/spec/adapter/win_ffi/label_spec.rb +21 -0
  107. data/spec/adapter/win_ffi/listbox_spec.rb +52 -0
  108. data/spec/adapter/win_ffi/radio_spec.rb +37 -0
  109. data/spec/adapter/win_ffi/select_list_spec.rb +66 -0
  110. data/spec/adapter/win_ffi/table_spec.rb +39 -0
  111. data/spec/adapter/win_ffi/text_field_spec.rb +23 -0
  112. data/spec/adapter/win_ffi/window_spec.rb +43 -0
  113. data/spec/button_spec.rb +68 -0
  114. data/spec/buttons_spec.rb +21 -0
  115. data/spec/spec_helper.rb +96 -0
  116. data/spec/text_field_spec.rb +65 -0
  117. data/spec/text_fields_spec.rb +22 -0
  118. data/spec/window_spec.rb +122 -0
  119. data/spec/windows_spec.rb +55 -0
  120. metadata +207 -0
@@ -0,0 +1,42 @@
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
+ </ItemGroup>
28
+ <ItemGroup>
29
+ <ClCompile Include="stdafx.cpp">
30
+ <Filter>Source Files</Filter>
31
+ </ClCompile>
32
+ <ClCompile Include="IAccessibleDLL.cpp">
33
+ <Filter>Source Files</Filter>
34
+ </ClCompile>
35
+ <ClCompile Include="dllmain.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>
@@ -0,0 +1,3 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
+ </Project>
@@ -0,0 +1,48 @@
1
+ ========================================================================
2
+ DYNAMIC LINK LIBRARY : IAccessibleDLL Project Overview
3
+ ========================================================================
4
+
5
+ AppWizard has created this IAccessibleDLL 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 IAccessibleDLL application.
9
+
10
+
11
+ IAccessibleDLL.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
+ IAccessibleDLL.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
+ IAccessibleDLL.cpp
25
+ This is the main DLL source file.
26
+
27
+ When created, this DLL does not export any symbols. As a result, it
28
+ will not produce a .lib file when it is built. If you wish this project
29
+ to be a project dependency of some other project, you will either need to
30
+ add code to export some symbols from the DLL so that an export library
31
+ will be produced, or you can set the Ignore Input Library property to Yes
32
+ on the General propert page of the Linker folder in the project's Property
33
+ Pages dialog box.
34
+
35
+ /////////////////////////////////////////////////////////////////////////////
36
+ Other standard files:
37
+
38
+ StdAfx.h, StdAfx.cpp
39
+ These files are used to build a precompiled header (PCH) file
40
+ named IAccessibleDLL.pch and a precompiled types file named StdAfx.obj.
41
+
42
+ /////////////////////////////////////////////////////////////////////////////
43
+ Other notes:
44
+
45
+ AppWizard uses "TODO:" comments to indicate parts of the source code you
46
+ should add to or customize.
47
+
48
+ /////////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,19 @@
1
+ // dllmain.cpp : Defines the entry point for the DLL application.
2
+ #include "stdafx.h"
3
+
4
+ BOOL APIENTRY DllMain( HMODULE hModule,
5
+ DWORD ul_reason_for_call,
6
+ LPVOID lpReserved
7
+ )
8
+ {
9
+ switch (ul_reason_for_call)
10
+ {
11
+ case DLL_PROCESS_ATTACH:
12
+ case DLL_THREAD_ATTACH:
13
+ case DLL_THREAD_DETACH:
14
+ case DLL_PROCESS_DETACH:
15
+ break;
16
+ }
17
+ return TRUE;
18
+ }
19
+
@@ -0,0 +1,8 @@
1
+ // stdafx.cpp : source file that includes just the standard includes
2
+ // IAccessibleDLL.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
@@ -0,0 +1,22 @@
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 <stdlib.h>
11
+
12
+ #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
13
+
14
+ #include <stdio.h>
15
+ #include <tchar.h>
16
+ #include <windows.h>
17
+ #include <objbase.h>
18
+ #include <OleAcc.h>
19
+ #include <Commctrl.h>
20
+ #include <comutil.h>
21
+
22
+ // TODO: reference additional headers your program requires here
@@ -0,0 +1,282 @@
1
+ #include "stdafx.h"
2
+
3
+ #define BUFFER_SIZE 255
4
+
5
+ long get_number_of_rows(IAccessible *pAccessible) {
6
+ long count ;
7
+
8
+ pAccessible->get_accChildCount(&count) ;
9
+ return count ;
10
+ }
11
+
12
+ void get_name(long childId, IAccessible *pAccessible, char *itemText) {
13
+ BSTR bstrValue ;
14
+
15
+ VARIANT varIn ;
16
+ VariantInit(&varIn) ;
17
+ varIn.vt = VT_I4 ;
18
+ varIn.lVal = childId ;
19
+
20
+ if (pAccessible->get_accName(varIn, &bstrValue) == S_OK) {
21
+ char *pszName = _com_util::ConvertBSTRToString(bstrValue) ;
22
+ strcpy(itemText, pszName) ;
23
+ delete[] pszName ;
24
+ SysFreeString(bstrValue) ;
25
+ } else
26
+ strcpy(itemText, "\0") ;
27
+ }
28
+
29
+ HRESULT get_role(long childId, IAccessible *pAccessible, long *pRole) {
30
+ VARIANT varIn ;
31
+ VariantInit(&varIn) ;
32
+ varIn.vt = VT_I4 ;
33
+ varIn.lVal = childId ;
34
+
35
+ VARIANT varOut ;
36
+ VariantInit(&varOut) ;
37
+ varOut.vt = VT_I4 ;
38
+
39
+ HRESULT hr = pAccessible->get_accRole(varIn, &varOut) ;
40
+ *pRole = varOut.lVal ;
41
+
42
+ return hr ;
43
+ }
44
+
45
+ void get_role(long childId, IAccessible *pAccessible, char *itemText) {
46
+ long role ;
47
+
48
+ if (get_role(childId, pAccessible, &role) == S_OK) {
49
+ int roleTextMax = 255 ;
50
+ LPTSTR pRoleText = new TCHAR[roleTextMax] ;
51
+ GetRoleText(role, pRoleText, roleTextMax) ;
52
+
53
+ int lenSzRoleText = 255 ;
54
+ char *pszRoleText = new char[lenSzRoleText] ;
55
+ WideCharToMultiByte(CP_ACP, 0, pRoleText, wcslen(pRoleText) + 1, pszRoleText, lenSzRoleText, NULL, NULL) ;
56
+
57
+ sprintf(itemText, "0x%x, %s", role, pszRoleText) ;
58
+ }
59
+ }
60
+
61
+ void get_description(long childId, IAccessible *pAccessible, char *itemText) {
62
+ BSTR bstrValue ;
63
+
64
+ VARIANT varIn ;
65
+ VariantInit(&varIn) ;
66
+ varIn.vt = VT_I4 ;
67
+ varIn.lVal = childId ;
68
+
69
+ if (pAccessible->get_accDescription(varIn, &bstrValue) == S_OK) {
70
+ char *pszName = _com_util::ConvertBSTRToString(bstrValue) ;
71
+ strcpy(itemText, pszName) ;
72
+ delete[] pszName ;
73
+ SysFreeString(bstrValue) ;
74
+ } else
75
+ strcpy(itemText, "\0") ;
76
+ }
77
+
78
+ void walk_tree(IAccessible *pAccessible, char **pColumnHeaderNames, long *pColumnHeadersCount) {
79
+ HRESULT hr ;
80
+ long childCount ;
81
+
82
+ hr = pAccessible->get_accChildCount(&childCount) ;
83
+ if (FAILED(hr) || childCount == 0)
84
+ return ;
85
+
86
+ VARIANT *pChildVariants = new VARIANT[childCount] ;
87
+ long childrenFound ;
88
+ hr = AccessibleChildren(pAccessible, 0, childCount, pChildVariants, &childrenFound) ;
89
+ if (FAILED(hr))
90
+ return ;
91
+
92
+ for (int i=1; i < childrenFound + 1; i++) {
93
+ VARIANT vChild = pChildVariants[i] ;
94
+ if (vChild.vt == VT_DISPATCH) {
95
+ IDispatch *pDispatch = vChild.pdispVal ;
96
+ IAccessible *pChildAccessible = NULL ;
97
+ hr = pDispatch->QueryInterface(IID_IAccessible, (void**) &pChildAccessible) ;
98
+ if (hr == S_OK) {
99
+ walk_tree(pChildAccessible, pColumnHeaderNames, pColumnHeadersCount) ;
100
+
101
+ pChildAccessible->Release() ;
102
+ }
103
+
104
+ pDispatch->Release() ;
105
+ } else {
106
+ long role ;
107
+ get_role(i, pAccessible, &role) ;
108
+ if (role == 0x19) {
109
+ if (pColumnHeaderNames == NULL) {
110
+ *pColumnHeadersCount = *pColumnHeadersCount + 1 ;
111
+ } else {
112
+ char *headerName = (char *)malloc(sizeof(char) * BUFFER_SIZE) ;
113
+ get_name(i, pAccessible, headerName) ;
114
+ pColumnHeaderNames[i - 1] = headerName ;
115
+ }
116
+ }
117
+ }
118
+ }
119
+ }
120
+
121
+ void find_column_headers(IAccessible *pAccessible, char ***pHeaderNames, long *pColumns) {
122
+ long columns = 0 ;
123
+
124
+ walk_tree(pAccessible, NULL, &columns) ;
125
+
126
+ char **pHeaders = (char **)malloc(sizeof(char *) * columns) ;
127
+ walk_tree(pAccessible, pHeaders, &columns) ;
128
+
129
+ *pHeaderNames = pHeaders ;
130
+ *pColumns = columns ;
131
+ }
132
+
133
+ char *trimwhitespace(char *str) {
134
+ char *end;
135
+ // Trim leading space
136
+ while(isspace(*str))
137
+ str++;
138
+ if(*str == 0)
139
+ // All spaces?
140
+ return str;
141
+ // Trim trailing space
142
+ end = str + strlen(str) - 1;
143
+
144
+ while(end > str && isspace(*end))
145
+ end--; // Write new null terminator
146
+
147
+ *(end+1) = 0;
148
+
149
+ return str;
150
+ }
151
+
152
+ char* remove_column_header_name(char *columnName, char *item) {
153
+ int itemLen = strlen(item) ;
154
+ int columnNameLen = strlen(columnName) ;
155
+
156
+ if (itemLen > 0) {
157
+ char *newItem = (char *)malloc(sizeof(char *) * (itemLen - columnNameLen)) ; // still a bit too long
158
+
159
+ strcpy(newItem, item + columnNameLen + 2) ; // :<space>
160
+
161
+ free(item) ;
162
+ return newItem ;
163
+ } else
164
+ return item ;
165
+ }
166
+
167
+ extern "C"
168
+ __declspec( dllexport ) void get_table_strings(HMODULE oleAccModule, HWND controlHwnd, void **tableStrings, long *numberOfRowsOut, long *numberOfColumnsOut) {
169
+ // * to *[] to *[] to * string
170
+ IAccessible *pAccessible ;
171
+ LPFNACCESSIBLEOBJECTFROMWINDOW lpfnAccessibleObjectFromWindow ;
172
+
173
+ lpfnAccessibleObjectFromWindow = (LPFNACCESSIBLEOBJECTFROMWINDOW)GetProcAddress(oleAccModule, "AccessibleObjectFromWindow");
174
+
175
+ if (HRESULT hResult = lpfnAccessibleObjectFromWindow(controlHwnd, OBJID_CLIENT, IID_IAccessible, (void**)&pAccessible) == S_OK) {
176
+ int numberOfRows = get_number_of_rows(pAccessible) ; // including the header
177
+ long numberOfColumns = 3 ;
178
+ char ***table_rows ;
179
+ char **pHeaderNames ;
180
+
181
+ find_column_headers(pAccessible, &pHeaderNames, &numberOfColumns) ;
182
+
183
+ table_rows = (char ***)malloc(sizeof(char*) * numberOfRows) ;
184
+ table_rows[0] = pHeaderNames ;
185
+
186
+ for (int row = 1; row < numberOfRows; row++) {
187
+ char **table_row = (char **)malloc(sizeof(char*) * numberOfColumns) ;
188
+
189
+ char *mainItem = (char *)malloc(sizeof(char) * BUFFER_SIZE) ;
190
+ get_name(row, pAccessible, mainItem) ;
191
+
192
+ char *description = (char *)malloc(sizeof(char) * 2048) ;
193
+ get_description(row, pAccessible, description) ;
194
+
195
+ char *token ;
196
+ if (strlen(description) > 0)
197
+ token = strtok(description, ",") ;
198
+ else
199
+ token = NULL ;
200
+
201
+ for (int column = 0; column < numberOfColumns; column++) {
202
+ if (column == 0)
203
+ table_row[column] = mainItem ;
204
+ else {
205
+ char *item = (char *)malloc(sizeof(char) * BUFFER_SIZE) ;
206
+
207
+ if (token != NULL) {
208
+ strcpy(item, token) ;
209
+ token = strtok(NULL, ",") ;
210
+ } else
211
+ strcpy(item, "\0") ;
212
+
213
+ table_row[column] = remove_column_header_name(pHeaderNames[column], trimwhitespace(item)) ;
214
+ }
215
+ }
216
+
217
+ table_rows[row] = table_row ;
218
+ }
219
+
220
+ *tableStrings = table_rows ;
221
+ *numberOfRowsOut = numberOfRows ;
222
+ *numberOfColumnsOut = numberOfColumns ;
223
+ } else {
224
+ *numberOfRowsOut = 0 ;
225
+ *numberOfColumnsOut = 0 ;
226
+ }
227
+ }
228
+
229
+ extern "C"
230
+ __declspec( dllexport ) void get_table_row_strings(HMODULE oleAccModule, HWND controlHwnd, void **pTableRow, long row, long *pColumns) {
231
+ long rows ;
232
+ long columns ;
233
+ char *tableStrings ; // pointer to array
234
+
235
+ get_table_strings(oleAccModule, controlHwnd, (void **)&tableStrings, &rows, &columns) ;
236
+
237
+ *pTableRow = ((char ***)tableStrings)[row] ;
238
+ *pColumns = columns ;
239
+ }
240
+
241
+ extern "C"
242
+ __declspec( dllexport ) void select_table_row(HMODULE oleAccModule, HWND controlHwnd, long row) {
243
+ IAccessible *pAccessible ;
244
+ LPFNACCESSIBLEOBJECTFROMWINDOW lpfnAccessibleObjectFromWindow ;
245
+
246
+ lpfnAccessibleObjectFromWindow = (LPFNACCESSIBLEOBJECTFROMWINDOW)GetProcAddress(oleAccModule, "AccessibleObjectFromWindow");
247
+
248
+ if (HRESULT hResult = lpfnAccessibleObjectFromWindow(controlHwnd, OBJID_CLIENT, IID_IAccessible, (void**)&pAccessible) == S_OK) {
249
+ VARIANT varChild ;
250
+ VariantInit(&varChild) ;
251
+ varChild.vt = VT_I4 ;
252
+ varChild.lVal = row ;
253
+
254
+ pAccessible->accSelect(SELFLAG_ADDSELECTION, varChild) ;
255
+ }
256
+ }
257
+
258
+ extern "C"
259
+ __declspec( dllexport ) long get_table_row_state(HMODULE oleAccModule, HWND controlHwnd, long row) {
260
+ IAccessible *pAccessible ;
261
+ LPFNACCESSIBLEOBJECTFROMWINDOW lpfnAccessibleObjectFromWindow ;
262
+
263
+ lpfnAccessibleObjectFromWindow = (LPFNACCESSIBLEOBJECTFROMWINDOW)GetProcAddress(oleAccModule, "AccessibleObjectFromWindow");
264
+
265
+ if (HRESULT hResult = lpfnAccessibleObjectFromWindow(controlHwnd, OBJID_CLIENT, IID_IAccessible, (void**)&pAccessible) == S_OK) {
266
+ VARIANT varChild ;
267
+ VariantInit(&varChild) ;
268
+ varChild.vt = VT_I4 ;
269
+ varChild.lVal = row ;
270
+
271
+ VARIANT varState ;
272
+
273
+ HRESULT hr = pAccessible->get_accState(varChild, &varState) ;
274
+ if (hr == S_OK) {
275
+ if (varState.vt == VT_I4) {
276
+ return varState.lVal ;
277
+ } else
278
+ return FALSE ;
279
+ } else
280
+ return FALSE ;
281
+ }
282
+ }
@@ -0,0 +1,8 @@
1
+ #pragma once
2
+
3
+ // Including SDKDDKVer.h defines the highest available Windows platform.
4
+
5
+ // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
6
+ // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
7
+
8
+ #include <SDKDDKVer.h>
@@ -0,0 +1,20 @@
1
+ 
2
+ Microsoft Visual Studio Solution File, Format Version 11.00
3
+ # Visual C++ Express 2010
4
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ListViewExplorer", "ListViewExplorer\ListViewExplorer.vcxproj", "{EF611F7A-863F-4062-AAD2-84D150F4D7C0}"
5
+ EndProject
6
+ Global
7
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
8
+ Debug|Win32 = Debug|Win32
9
+ Release|Win32 = Release|Win32
10
+ EndGlobalSection
11
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
12
+ {EF611F7A-863F-4062-AAD2-84D150F4D7C0}.Debug|Win32.ActiveCfg = Debug|Win32
13
+ {EF611F7A-863F-4062-AAD2-84D150F4D7C0}.Debug|Win32.Build.0 = Debug|Win32
14
+ {EF611F7A-863F-4062-AAD2-84D150F4D7C0}.Release|Win32.ActiveCfg = Release|Win32
15
+ {EF611F7A-863F-4062-AAD2-84D150F4D7C0}.Release|Win32.Build.0 = Release|Win32
16
+ EndGlobalSection
17
+ GlobalSection(SolutionProperties) = preSolution
18
+ HideSolutionNode = FALSE
19
+ EndGlobalSection
20
+ EndGlobal