rautomation 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.rdoc +14 -0
- data/README.rdoc +1 -1
- data/VERSION +1 -1
- data/ext/IAccessibleDLL/IAccessibleDLL.suo +0 -0
- data/ext/IAccessibleDLL/IAccessibleDLL/IAccessibleDLL.cpp +0 -6
- data/ext/IAccessibleDLL/IAccessibleDLL/IAccessibleDLL.vcxproj +2 -0
- data/ext/IAccessibleDLL/IAccessibleDLL/IAccessibleDLL.vcxproj.filters +3 -0
- data/ext/IAccessibleDLL/IAccessibleDLL/stdafx.h +9 -3
- data/ext/IAccessibleDLL/IAccessibleDLL/table_support.cpp +282 -0
- data/ext/IAccessibleDLL/Release/IAccessibleDLL.dll +0 -0
- data/ext/ListViewExplorer/ListViewExplorer.sln +20 -0
- data/ext/ListViewExplorer/ListViewExplorer.suo +0 -0
- data/ext/ListViewExplorer/ListViewExplorer/ListViewExplorer.cpp +174 -0
- data/ext/ListViewExplorer/ListViewExplorer/ListViewExplorer.vcxproj +95 -0
- data/ext/ListViewExplorer/ListViewExplorer/ListViewExplorer.vcxproj.filters +42 -0
- data/ext/ListViewExplorer/ListViewExplorer/ListViewExplorer.vcxproj.user +3 -0
- data/ext/ListViewExplorer/ListViewExplorer/ReadMe.txt +40 -0
- data/ext/ListViewExplorer/ListViewExplorer/stdafx.cpp +8 -0
- data/ext/ListViewExplorer/ListViewExplorer/stdafx.h +17 -0
- data/ext/ListViewExplorer/ListViewExplorer/table_support.cpp +250 -0
- data/ext/ListViewExplorer/ListViewExplorer/table_support.h +2 -0
- data/ext/ListViewExplorer/ListViewExplorer/targetver.h +8 -0
- data/ext/UiaDll/Release/UiaDll.dll +0 -0
- data/ext/UiaDll/UiaDll.sln +20 -0
- data/ext/UiaDll/UiaDll.suo +0 -0
- data/ext/UiaDll/UiaDll/ReadMe.txt +48 -0
- data/ext/UiaDll/UiaDll/UiaDll.cpp +205 -0
- data/ext/UiaDll/UiaDll/UiaDll.vcxproj +104 -0
- data/ext/UiaDll/UiaDll/UiaDll.vcxproj.filters +42 -0
- data/ext/UiaDll/UiaDll/dllmain.cpp +39 -0
- data/ext/UiaDll/UiaDll/globals.h +3 -0
- data/ext/UiaDll/UiaDll/stdafx.cpp +8 -0
- data/ext/UiaDll/UiaDll/stdafx.h +19 -0
- data/ext/UiaDll/UiaDll/targetver.h +8 -0
- data/ext/WindowsForms/bin/WindowsForms.exe +0 -0
- data/ext/WindowsForms/src/WindowsForms/WindowsForms.suo +0 -0
- data/ext/WindowsForms/src/WindowsForms/WindowsForms/DataEntryForm.Designer.cs +27 -7
- data/ext/WindowsForms/src/WindowsForms/WindowsForms/DataEntryForm.cs +1 -0
- data/ext/WindowsForms/src/WindowsForms/WindowsForms/MainFormWindow.Designer.cs +110 -11
- data/ext/WindowsForms/src/WindowsForms/WindowsForms/bin/Release/WindowsForms.exe +0 -0
- data/lib/rautomation.rb +2 -3
- data/lib/rautomation/adapter/autoit.rb +2 -2
- data/lib/rautomation/adapter/win_ffi.rb +4 -0
- data/lib/rautomation/adapter/win_ffi/button.rb +6 -0
- data/lib/rautomation/adapter/win_ffi/checkbox.rb +7 -0
- data/lib/rautomation/adapter/win_ffi/constants.rb +44 -3
- data/lib/rautomation/adapter/win_ffi/control.rb +36 -3
- data/lib/rautomation/adapter/win_ffi/functions.rb +37 -3
- data/lib/rautomation/adapter/win_ffi/keystroke_converter.rb +67 -0
- data/lib/rautomation/adapter/win_ffi/label.rb +21 -0
- data/lib/rautomation/adapter/win_ffi/list_box.rb +60 -0
- data/lib/rautomation/adapter/win_ffi/locators.rb +0 -1
- data/lib/rautomation/adapter/win_ffi/ms_uia/uia_dll.rb +36 -0
- data/lib/rautomation/adapter/win_ffi/radio.rb +7 -0
- data/lib/rautomation/adapter/win_ffi/select_list.rb +30 -7
- data/lib/rautomation/adapter/win_ffi/table.rb +42 -3
- data/lib/rautomation/adapter/win_ffi/text_field.rb +17 -1
- data/lib/rautomation/adapter/win_ffi/window.rb +47 -8
- data/lib/rautomation/button.rb +5 -0
- data/lib/rautomation/element_collections.rb +8 -5
- data/lib/rautomation/text_field.rb +10 -0
- data/lib/rautomation/window.rb +20 -14
- data/spec/adapter/win_ffi/button_spec.rb +41 -0
- data/spec/adapter/win_ffi/checkbox_spec.rb +19 -0
- data/spec/adapter/win_ffi/keystroke_converter_spec.rb +47 -0
- data/spec/adapter/win_ffi/label_spec.rb +21 -0
- data/spec/adapter/win_ffi/listbox_spec.rb +52 -0
- data/spec/adapter/win_ffi/radio_spec.rb +16 -0
- data/spec/adapter/win_ffi/select_list_spec.rb +29 -4
- data/spec/adapter/win_ffi/table_spec.rb +20 -1
- data/spec/adapter/win_ffi/text_field_spec.rb +23 -0
- data/spec/adapter/win_ffi/window_spec.rb +29 -0
- data/spec/button_spec.rb +1 -0
- data/spec/spec_helper.rb +4 -1
- data/spec/text_field_spec.rb +27 -15
- metadata +52 -34
- data/ext/IAccessibleDLL/Release/IAccessibleDLL.exp +0 -0
- data/ext/IAccessibleDLL/Release/IAccessibleDLL.lib +0 -0
- data/ext/WindowsForms/src/WindowsForms/WindowsForms/bin/Debug/WindowsForms.exe +0 -0
- data/ext/WindowsForms/src/WindowsForms/WindowsForms/bin/Debug/WindowsForms.pdb +0 -0
- data/ext/WindowsForms/src/WindowsForms/WindowsForms/bin/Debug/WindowsForms.vshost.exe +0 -0
- data/ext/WindowsForms/src/WindowsForms/WindowsForms/bin/Debug/WindowsForms.vshost.exe.manifest +0 -11
- data/ext/WindowsForms/src/WindowsForms/WindowsForms/obj/x86/Debug/DesignTimeResolveAssemblyReferences.cache +0 -0
- data/ext/WindowsForms/src/WindowsForms/WindowsForms/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache +0 -0
- data/ext/WindowsForms/src/WindowsForms/WindowsForms/obj/x86/Debug/GenerateResource.read.1.tlog +0 -0
- data/ext/WindowsForms/src/WindowsForms/WindowsForms/obj/x86/Debug/GenerateResource.write.1.tlog +0 -0
- data/ext/WindowsForms/src/WindowsForms/WindowsForms/obj/x86/Debug/ResolveAssemblyReference.cache +0 -0
- data/ext/WindowsForms/src/WindowsForms/WindowsForms/obj/x86/Debug/WindowsForms.AboutBox.resources +0 -0
- data/ext/WindowsForms/src/WindowsForms/WindowsForms/obj/x86/Debug/WindowsForms.DataEntryForm.resources +0 -0
- data/ext/WindowsForms/src/WindowsForms/WindowsForms/obj/x86/Debug/WindowsForms.MainFormWindow.resources +0 -0
- data/ext/WindowsForms/src/WindowsForms/WindowsForms/obj/x86/Debug/WindowsForms.PersonForm.resources +0 -0
- data/ext/WindowsForms/src/WindowsForms/WindowsForms/obj/x86/Debug/WindowsForms.Properties.Resources.resources +0 -0
- data/ext/WindowsForms/src/WindowsForms/WindowsForms/obj/x86/Debug/WindowsForms.SimpleElementsForm.resources +0 -0
- data/ext/WindowsForms/src/WindowsForms/WindowsForms/obj/x86/Debug/WindowsForms.csproj.FileListAbsolute.txt +0 -25
- data/ext/WindowsForms/src/WindowsForms/WindowsForms/obj/x86/Debug/WindowsForms.exe +0 -0
- data/ext/WindowsForms/src/WindowsForms/WindowsForms/obj/x86/Debug/WindowsForms.pdb +0 -0
@@ -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>
|
Binary file
|
@@ -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}") = "UiaDll", "UiaDll\UiaDll.vcxproj", "{8B796959-2EAB-4C6E-BE57-BE1B4BF3298F}"
|
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
|
+
{8B796959-2EAB-4C6E-BE57-BE1B4BF3298F}.Debug|Win32.ActiveCfg = Debug|Win32
|
13
|
+
{8B796959-2EAB-4C6E-BE57-BE1B4BF3298F}.Debug|Win32.Build.0 = Debug|Win32
|
14
|
+
{8B796959-2EAB-4C6E-BE57-BE1B4BF3298F}.Release|Win32.ActiveCfg = Release|Win32
|
15
|
+
{8B796959-2EAB-4C6E-BE57-BE1B4BF3298F}.Release|Win32.Build.0 = Release|Win32
|
16
|
+
EndGlobalSection
|
17
|
+
GlobalSection(SolutionProperties) = preSolution
|
18
|
+
HideSolutionNode = FALSE
|
19
|
+
EndGlobalSection
|
20
|
+
EndGlobal
|
Binary file
|
@@ -0,0 +1,48 @@
|
|
1
|
+
========================================================================
|
2
|
+
DYNAMIC LINK LIBRARY : UiaDll Project Overview
|
3
|
+
========================================================================
|
4
|
+
|
5
|
+
AppWizard has created this UiaDll DLL for you.
|
6
|
+
|
7
|
+
This file contains a summary of what you will find in each of the files that
|
8
|
+
make up your UiaDll application.
|
9
|
+
|
10
|
+
|
11
|
+
UiaDll.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
|
+
UiaDll.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
|
+
UiaDll.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 UiaDll.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,205 @@
|
|
1
|
+
// UiaDll.cpp : Defines the exported functions for the DLL application.
|
2
|
+
//
|
3
|
+
|
4
|
+
#include "stdafx.h"
|
5
|
+
|
6
|
+
extern "C"
|
7
|
+
__declspec( dllexport ) IUIAutomationElement *RA_FindWindow(char *pszAutomationId) {
|
8
|
+
IUIAutomationElement *pRootElement ;
|
9
|
+
|
10
|
+
HRESULT hr = getGlobalIUIAutomation()->GetRootElement(&pRootElement) ;
|
11
|
+
if (SUCCEEDED(hr)) {
|
12
|
+
IUIAutomationCondition *pCondition ;
|
13
|
+
VARIANT varProperty ;
|
14
|
+
|
15
|
+
VariantInit(&varProperty) ;
|
16
|
+
varProperty.vt = VT_BSTR ;
|
17
|
+
varProperty.bstrVal = _bstr_t(pszAutomationId) ;
|
18
|
+
|
19
|
+
hr = getGlobalIUIAutomation()->CreatePropertyCondition(UIA_AutomationIdPropertyId, varProperty, &pCondition) ;
|
20
|
+
if (SUCCEEDED(hr)) {
|
21
|
+
IUIAutomationElement *pFound ;
|
22
|
+
|
23
|
+
hr = pRootElement->FindFirst(TreeScope_Children, pCondition, &pFound) ;
|
24
|
+
if (SUCCEEDED(hr)) {
|
25
|
+
return pFound ;
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}
|
29
|
+
return NULL ;
|
30
|
+
}
|
31
|
+
|
32
|
+
extern "C"
|
33
|
+
__declspec( dllexport ) BOOL RA_IsOffscreen(IUIAutomationElement *pElement) {
|
34
|
+
BOOL isOffscreen ;
|
35
|
+
pElement->get_CurrentIsOffscreen(&isOffscreen) ;
|
36
|
+
|
37
|
+
return isOffscreen ;
|
38
|
+
}
|
39
|
+
|
40
|
+
extern "C"
|
41
|
+
__declspec ( dllexport ) IUIAutomationElement *RA_ElementFromHandle(HWND hwnd) {
|
42
|
+
IUIAutomationElement *pElement ;
|
43
|
+
|
44
|
+
HRESULT hr = getGlobalIUIAutomation()->ElementFromHandle(hwnd, &pElement) ;
|
45
|
+
if (SUCCEEDED(hr))
|
46
|
+
return pElement ;
|
47
|
+
else {
|
48
|
+
printf("RA_ElementFromHandle: Cannot find element from handle 0x%x. HRESULT was 0x%x\r\n", hwnd, hr) ;
|
49
|
+
return NULL ;
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
53
|
+
extern "C" __declspec ( dllexport ) IUIAutomationElement *RA_FindChildById(IUIAutomationElement *pElement, char *automationId) {
|
54
|
+
IUIAutomationCondition *pCondition ;
|
55
|
+
VARIANT varProperty ;
|
56
|
+
|
57
|
+
VariantInit(&varProperty) ;
|
58
|
+
varProperty.vt = VT_BSTR ;
|
59
|
+
varProperty.bstrVal = _bstr_t(automationId) ;
|
60
|
+
|
61
|
+
HRESULT hr = getGlobalIUIAutomation()->CreatePropertyCondition(UIA_AutomationIdPropertyId, varProperty, &pCondition) ;
|
62
|
+
if (SUCCEEDED(hr)) {
|
63
|
+
IUIAutomationElement *pFound ;
|
64
|
+
|
65
|
+
hr = pElement->FindFirst(TreeScope_Descendants, pCondition, &pFound) ;
|
66
|
+
if (SUCCEEDED(hr)) {
|
67
|
+
if (pFound == NULL)
|
68
|
+
printf("RA_FindChildById: Element with automation id %s was not found\r\n", automationId) ;
|
69
|
+
|
70
|
+
return pFound ;
|
71
|
+
} else {
|
72
|
+
printf("RA_FindChildById: FindFirst for children looking for %s failed. hr = 0x%x\r\n", automationId, hr) ;
|
73
|
+
return NULL ;
|
74
|
+
}
|
75
|
+
} else {
|
76
|
+
printf("RA_FindChildById: Cannot create search condition. hr = 0x%x\r\n", hr) ;
|
77
|
+
return NULL ;
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
extern "C" __declspec ( dllexport ) HWND RA_CurrentNativeWindowHandle(IUIAutomationElement *pElement) {
|
82
|
+
UIA_HWND uia_hwnd ;
|
83
|
+
|
84
|
+
if (pElement == NULL) {
|
85
|
+
printf("RA_CurrentNativeWindowHandle: Cannot operate on NULL element\r\n") ;
|
86
|
+
return (HWND)0 ;
|
87
|
+
}
|
88
|
+
|
89
|
+
pElement->get_CurrentNativeWindowHandle(&uia_hwnd) ;
|
90
|
+
return (HWND)uia_hwnd ;
|
91
|
+
}
|
92
|
+
|
93
|
+
extern "C" __declspec ( dllexport ) BOOL RA_SetFocus(IUIAutomationElement *pElement) {
|
94
|
+
HRESULT hr = pElement->SetFocus() ;
|
95
|
+
if (hr != S_OK)
|
96
|
+
printf("RA_SetFocus: SetFocus on element returned 0x%x\r\n", hr) ;
|
97
|
+
|
98
|
+
return SUCCEEDED(hr) ;
|
99
|
+
}
|
100
|
+
|
101
|
+
extern "C" __declspec ( dllexport ) int RA_GetCurrentControlType(IUIAutomationElement *pElement) {
|
102
|
+
CONTROLTYPEID control_type ;
|
103
|
+
|
104
|
+
HRESULT hr = pElement->get_CurrentControlType(&control_type) ;
|
105
|
+
if (SUCCEEDED(hr))
|
106
|
+
return control_type ;
|
107
|
+
else {
|
108
|
+
printf("RA_GetCurrentControlType: CurrentControlType returned 0x%x\r\n", hr) ;
|
109
|
+
return 0 ;
|
110
|
+
}
|
111
|
+
}
|
112
|
+
|
113
|
+
extern "C" __declspec ( dllexport ) int RA_FindChildren(IUIAutomationElement *pElement, IUIAutomationElement *pChildren[]) {
|
114
|
+
IUIAutomationCondition *pTrueCondition ;
|
115
|
+
IUIAutomationElementArray *pElementArray ;
|
116
|
+
int element_count ;
|
117
|
+
|
118
|
+
HRESULT hr = getGlobalIUIAutomation()->CreateTrueCondition(&pTrueCondition) ;
|
119
|
+
if (FAILED(hr)) {
|
120
|
+
printf("RA_FindChildren: Could not create true condition 0x%x\r\n", hr) ;
|
121
|
+
return 0 ;
|
122
|
+
}
|
123
|
+
|
124
|
+
hr = pElement->FindAll(TreeScope_Children, pTrueCondition, &pElementArray) ;
|
125
|
+
if (FAILED(hr)) {
|
126
|
+
printf("RA_FindChildren: FindAll failed 0x%x\r\n", hr) ;
|
127
|
+
return 0 ;
|
128
|
+
}
|
129
|
+
|
130
|
+
hr = pElementArray->get_Length(&element_count) ;
|
131
|
+
if (FAILED(hr)) {
|
132
|
+
printf("RA_FindChildren: get_length failed 0x%x\r\n", hr) ;
|
133
|
+
return 0 ;
|
134
|
+
}
|
135
|
+
|
136
|
+
if (pChildren != NULL) {
|
137
|
+
// given some memory get the details
|
138
|
+
for (int index = 0; index < element_count; index++) {
|
139
|
+
IUIAutomationElement *pElement ;
|
140
|
+
|
141
|
+
hr = pElementArray->GetElement(index, &pElement) ;
|
142
|
+
if (FAILED(hr)) {
|
143
|
+
printf("RA_FindChildren: GetElement failed 0x%x\r\n", hr) ;
|
144
|
+
} else {
|
145
|
+
pChildren[index] = pElement ;
|
146
|
+
}
|
147
|
+
}
|
148
|
+
}
|
149
|
+
|
150
|
+
return element_count ;
|
151
|
+
}
|
152
|
+
|
153
|
+
extern "C" __declspec ( dllexport ) int RA_GetName(IUIAutomationElement *pElement, char *pName) {
|
154
|
+
BSTR bstrName ;
|
155
|
+
HRESULT hr = pElement->get_CurrentName(&bstrName) ;
|
156
|
+
if (FAILED(hr)) {
|
157
|
+
printf("RA_GetName: get_CurrentName failed 0x%x\r\n", hr) ;
|
158
|
+
return 0 ;
|
159
|
+
}
|
160
|
+
|
161
|
+
char *pszName = _com_util::ConvertBSTRToString(bstrName) ;
|
162
|
+
if (pName == NULL) {
|
163
|
+
return strlen(pszName) ;
|
164
|
+
} else {
|
165
|
+
strcpy(pName, pszName) ;
|
166
|
+
return strlen(pszName) ;
|
167
|
+
}
|
168
|
+
}
|
169
|
+
|
170
|
+
extern "C" __declspec ( dllexport ) BOOL RA_GetIsSelected(IUIAutomationElement *pElement, int *pResult) {
|
171
|
+
ISelectionItemProvider *pSelectionPattern ;
|
172
|
+
HRESULT hr = pElement->GetCurrentPattern(UIA_SelectionItemPatternId, (IUnknown**)&pSelectionPattern) ;
|
173
|
+
|
174
|
+
if (FAILED(hr)) {
|
175
|
+
printf("RA_GetIsSelected: getCurrentPattern failed 0x%x\r\n") ;
|
176
|
+
return FALSE ;
|
177
|
+
}
|
178
|
+
|
179
|
+
BOOL pRetVal ;
|
180
|
+
hr = pSelectionPattern->get_IsSelected(&pRetVal) ;
|
181
|
+
if (FAILED(hr)) {
|
182
|
+
printf("RA_GetIsSelected: get_IsSelected failed 0x%x\r\n", hr) ;
|
183
|
+
return FALSE ;
|
184
|
+
} else {
|
185
|
+
*pResult = pRetVal ;
|
186
|
+
return TRUE ;
|
187
|
+
}
|
188
|
+
}
|
189
|
+
|
190
|
+
extern "C" __declspec ( dllexport ) int RA_Select(IUIAutomationElement *pElement) {
|
191
|
+
ISelectionItemProvider *pSelectionPattern ;
|
192
|
+
HRESULT hr = pElement->GetCurrentPattern(UIA_SelectionItemPatternId, (IUnknown**)&pSelectionPattern) ;
|
193
|
+
if (FAILED(hr)) {
|
194
|
+
printf("RA_GetIsSelected: getCurrentPattern failed 0x%x\r\n") ;
|
195
|
+
return FALSE ;
|
196
|
+
}
|
197
|
+
|
198
|
+
hr = pSelectionPattern->Select();
|
199
|
+
if (FAILED(hr)) {
|
200
|
+
printf("RA_Select: Select failed 0x%x\r\n", hr) ;
|
201
|
+
return 0 ;
|
202
|
+
}
|
203
|
+
|
204
|
+
return 1;
|
205
|
+
}
|
@@ -0,0 +1,104 @@
|
|
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>{8B796959-2EAB-4C6E-BE57-BE1B4BF3298F}</ProjectGuid>
|
15
|
+
<Keyword>Win32Proj</Keyword>
|
16
|
+
<RootNamespace>UiaDll</RootNamespace>
|
17
|
+
</PropertyGroup>
|
18
|
+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
19
|
+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
20
|
+
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
21
|
+
<UseDebugLibraries>true</UseDebugLibraries>
|
22
|
+
<CharacterSet>Unicode</CharacterSet>
|
23
|
+
</PropertyGroup>
|
24
|
+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
25
|
+
<ConfigurationType>DynamicLibrary</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;_WINDOWS;_USRDLL;UIADLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
52
|
+
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
53
|
+
</ClCompile>
|
54
|
+
<Link>
|
55
|
+
<SubSystem>Windows</SubSystem>
|
56
|
+
<GenerateDebugInformation>true</GenerateDebugInformation>
|
57
|
+
<AdditionalDependencies>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;_WINDOWS;_USRDLL;UIADLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
68
|
+
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
69
|
+
</ClCompile>
|
70
|
+
<Link>
|
71
|
+
<SubSystem>Windows</SubSystem>
|
72
|
+
<GenerateDebugInformation>true</GenerateDebugInformation>
|
73
|
+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
74
|
+
<OptimizeReferences>true</OptimizeReferences>
|
75
|
+
<AdditionalDependencies>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>
|
76
|
+
</Link>
|
77
|
+
</ItemDefinitionGroup>
|
78
|
+
<ItemGroup>
|
79
|
+
<None Include="ReadMe.txt" />
|
80
|
+
</ItemGroup>
|
81
|
+
<ItemGroup>
|
82
|
+
<ClInclude Include="globals.h" />
|
83
|
+
<ClInclude Include="stdafx.h" />
|
84
|
+
<ClInclude Include="targetver.h" />
|
85
|
+
</ItemGroup>
|
86
|
+
<ItemGroup>
|
87
|
+
<ClCompile Include="dllmain.cpp">
|
88
|
+
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged>
|
89
|
+
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
90
|
+
</PrecompiledHeader>
|
91
|
+
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsManaged>
|
92
|
+
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
93
|
+
</PrecompiledHeader>
|
94
|
+
</ClCompile>
|
95
|
+
<ClCompile Include="stdafx.cpp">
|
96
|
+
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
97
|
+
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
98
|
+
</ClCompile>
|
99
|
+
<ClCompile Include="UiaDll.cpp" />
|
100
|
+
</ItemGroup>
|
101
|
+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
102
|
+
<ImportGroup Label="ExtensionTargets">
|
103
|
+
</ImportGroup>
|
104
|
+
</Project>
|
@@ -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
|
+
<ClInclude Include="globals.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="UiaDll.cpp">
|
36
|
+
<Filter>Source Files</Filter>
|
37
|
+
</ClCompile>
|
38
|
+
<ClCompile Include="dllmain.cpp">
|
39
|
+
<Filter>Source Files</Filter>
|
40
|
+
</ClCompile>
|
41
|
+
</ItemGroup>
|
42
|
+
</Project>
|
@@ -0,0 +1,39 @@
|
|
1
|
+
// dllmain.cpp : Defines the entry point for the DLL application.
|
2
|
+
#include "stdafx.h"
|
3
|
+
|
4
|
+
IUIAutomation *pAutomation ;
|
5
|
+
|
6
|
+
IUIAutomation* getGlobalIUIAutomation() {
|
7
|
+
return pAutomation ;
|
8
|
+
}
|
9
|
+
|
10
|
+
|
11
|
+
BOOL APIENTRY DllMain( HMODULE hModule,
|
12
|
+
DWORD ul_reason_for_call,
|
13
|
+
LPVOID lpReserved
|
14
|
+
)
|
15
|
+
{
|
16
|
+
switch (ul_reason_for_call)
|
17
|
+
{
|
18
|
+
case DLL_PROCESS_ATTACH:
|
19
|
+
case DLL_THREAD_ATTACH:
|
20
|
+
HRESULT hr ;
|
21
|
+
hr = CoInitialize(NULL) ;
|
22
|
+
if (FAILED(hr)) {
|
23
|
+
printf("UiaDll: CoInitialize failed. hr = 0x%x", hr) ;
|
24
|
+
return FALSE ;
|
25
|
+
}
|
26
|
+
hr = CoCreateInstance(__uuidof(CUIAutomation), NULL, CLSCTX_INPROC_SERVER, __uuidof(IUIAutomation), (void**)&pAutomation);
|
27
|
+
if (FAILED(hr)) {
|
28
|
+
printf("UiaDll: CoCreateInstance failed. hr = 0x%x", hr) ;
|
29
|
+
return FALSE ;
|
30
|
+
}
|
31
|
+
break ;
|
32
|
+
case DLL_THREAD_DETACH:
|
33
|
+
case DLL_PROCESS_DETACH:
|
34
|
+
CoUninitialize() ;
|
35
|
+
break;
|
36
|
+
}
|
37
|
+
return TRUE;
|
38
|
+
}
|
39
|
+
|