source: cprs/branches/GUI-config/CPRS-Lib/uAccessAPI.pas@ 1085

Last change on this file since 1085 was 476, checked in by Kevin Toppenberg, 16 years ago

New WorldVistA Config Utility

File size: 4.3 KB
Line 
1unit uAccessAPI;
2
3
4interface
5
6uses
7 Accessibility_TLB,
8 Controls,
9 ComCtrls,
10 Windows;
11
12function GetDefaultObject( Control: TWinControl): IAccessible; overload;
13function GetDefaultObject( Control: TTreeNode): IAccessible; overload;
14function GetLResult( wParam: integer; MyInterface: IAccessible): integer;
15
16const
17 ROLE_SYSTEM_TITLEBAR = $1;
18 ROLE_SYSTEM_MENUBAR = $2;
19 ROLE_SYSTEM_SCROLLBAR = $3;
20 ROLE_SYSTEM_GRIP = $4;
21 ROLE_SYSTEM_SOUND = $5;
22 ROLE_SYSTEM_CURSOR = $6;
23 ROLE_SYSTEM_CARET = $7;
24 ROLE_SYSTEM_ALERT = $8;
25 ROLE_SYSTEM_WINDOW = $9;
26 ROLE_SYSTEM_CLIENT = $a;
27 ROLE_SYSTEM_MENUPOPUP = $b;
28 ROLE_SYSTEM_MENUITEM = $c;
29 ROLE_SYSTEM_TOOLTIP = $d;
30 ROLE_SYSTEM_APPLICATION = $e;
31 ROLE_SYSTEM_DOCUMENT = $f;
32 ROLE_SYSTEM_PANE = $10;
33 ROLE_SYSTEM_CHART = $11;
34 ROLE_SYSTEM_DIALOG = $12;
35 ROLE_SYSTEM_BORDER = $13;
36 ROLE_SYSTEM_GROUPING = $14;
37 ROLE_SYSTEM_SEPARATOR = $15;
38 ROLE_SYSTEM_TOOLBAR = $16;
39 ROLE_SYSTEM_STATUSBAR = $17;
40 ROLE_SYSTEM_TABLE = $18;
41 ROLE_SYSTEM_COLUMNHEADER = $19;
42 ROLE_SYSTEM_ROWHEADER = $1a;
43 ROLE_SYSTEM_COLUMN = $1b;
44 ROLE_SYSTEM_ROW = $1c;
45 ROLE_SYSTEM_CELL = $1d;
46 ROLE_SYSTEM_LINK = $1e;
47 ROLE_SYSTEM_HELPBALLOON = $1f;
48 ROLE_SYSTEM_CHARACTER = $20;
49 ROLE_SYSTEM_LIST = $21;
50 ROLE_SYSTEM_LISTITEM = $22;
51 ROLE_SYSTEM_OUTLINE = $23;
52 ROLE_SYSTEM_OUTLINEITEM = $24;
53 ROLE_SYSTEM_PAGETAB = $25;
54 ROLE_SYSTEM_PROPERTYPAGE = $26;
55 ROLE_SYSTEM_INDICATOR = $27;
56 ROLE_SYSTEM_GRAPHIC = $28;
57 ROLE_SYSTEM_STATICTEXT = $29;
58 ROLE_SYSTEM_TEXT = $2a;
59 ROLE_SYSTEM_PUSHBUTTON = $2b;
60 ROLE_SYSTEM_CHECKBUTTON = $2c;
61 ROLE_SYSTEM_RADIOBUTTON = $2d;
62 ROLE_SYSTEM_COMBOBOX = $2e;
63 ROLE_SYSTEM_DROPLIST = $2f;
64 ROLE_SYSTEM_PROGRESSBAR = $30;
65 ROLE_SYSTEM_DIAL = $31;
66 ROLE_SYSTEM_HOTKEYFIELD = $32;
67 ROLE_SYSTEM_SLIDER = $33;
68 ROLE_SYSTEM_SPINBUTTON = $34;
69 ROLE_SYSTEM_DIAGRAM = $35;
70 ROLE_SYSTEM_ANIMATION = $36;
71 ROLE_SYSTEM_EQUATION = $37;
72 ROLE_SYSTEM_BUTTONDROPDOWN = $38;
73 ROLE_SYSTEM_BUTTONMENU = $39;
74 ROLE_SYSTEM_BUTTONDROPDOWNGRID = $3a;
75 ROLE_SYSTEM_WHITESPACE = $3b;
76 ROLE_SYSTEM_PAGETABLIST = $3c;
77 ROLE_SYSTEM_CLOCK = $3d;
78
79
80 NAVDIR_MIN = 0;
81 NAVDIR_UP = 1;
82 NAVDIR_DOWN = 2;
83 NAVDIR_LEFT = 3;
84 NAVDIR_RIGHT = 4;
85 NAVDIR_NEXT = 5;
86 NAVDIR_PREVIOUS = 6;
87 NAVDIR_FIRSTCHILD = 7;
88 NAVDIR_LASTCHILD = 8;
89 NAVDIR_MAX = 9;
90
91implementation
92
93uses
94 Classes;
95
96type
97 TCreateStdAccessibleObject = function(hwnd: HWND; idObject: DWORD; const riid: TGUID; var Accessible: IAccessible): integer; stdcall;
98 TLresultFromObject = function( const riid: TGUID; wParam: integer; Accessible: Pointer): integer; stdcall;
99
100 PhysicalInterfaceReference = record
101 P1: pointer;
102 P2: pointer;
103 end;
104
105 PPhysicalInterfaceReference = ^PhysicalInterfaceReference;
106
107var
108 CreateStdAccessibleObject: TCreateStdAccessibleObject;
109 LresultFromObject: TLresultFromObject;
110var
111
112 OleAccHandle: THandle;
113
114function GetDefaultObject( Control: TWinControl): IAccessible;
115begin
116 if Assigned(CreateStdAccessibleObject) then
117 begin
118 if CreateStdAccessibleObject(Control.Handle, OBJID_CLIENT, IID_IAccessible, Result) <> S_OK then
119 result := nil;
120 end
121 else
122 result := nil;
123end;
124
125function GetDefaultObject( Control: TTreeNode): IAccessible;
126begin
127 if Assigned(CreateStdAccessibleObject) then
128 begin
129 if CreateStdAccessibleObject(Control.Handle, OBJID_CLIENT, IID_IAccessible, Result) <> S_OK then
130 result := nil;
131 end
132 else
133 result := nil;
134end;
135
136function GetLResult( wParam: integer; MyInterface: IAccessible): integer;
137begin
138 if Assigned(LresultFromObject) then
139 begin
140 result := LresultFromObject(IID_IAccessible, wParam, PPhysicalInterfaceReference(@MyInterface)^.P1); // Increments ref count
141 end
142 else
143 result := E_NOINTERFACE;
144end;
145
146
147initialization
148 OleAccHandle := LoadLibrary('OLEACC.DLL');
149 if OleAccHandle <> 0 then
150 begin
151 @CreateStdAccessibleObject := GetProcAddress(OleAccHandle, 'CreateStdAccessibleObject');
152 @LresultFromObject := GetProcAddress(OleAccHandle, 'LresultFromObject');
153 end
154 else
155 begin
156 @CreateStdAccessibleObject := nil;
157 @LresultFromObject := nil;
158 end;
159
160finalization
161 if OleAccHandle <> 0 then
162 FreeLibrary(OleAccHandle);
163
164end.
165
Note: See TracBrowser for help on using the repository browser.