source: cprs/trunk/VA/VA508Accessibility/JAWS/JAWSCommon.pas@ 1619

Last change on this file since 1619 was 829, checked in by Kevin Toppenberg, 14 years ago

Upgrade to version 27

File size: 2.1 KB
Line 
1unit JAWSCommon;
2
3interface
4
5uses
6 SysUtils, Windows, Messages, Registry, StrUtils;
7
8const
9 DLL_MESSAGE_ID_NAME: PChar = 'VA 508 / Freedom Scientific - JAWS Communication Message ID';
10
11 DISPATCHER_WINDOW_CLASS = 'TfrmVA508JawsDispatcherHiddenWindow';
12 DISPATCHER_WINDOW_TITLE = 'VA 508 JAWS Dispatcher Window';
13 DISPATCHER_WINDOW_TITLE_LEN = length(DISPATCHER_WINDOW_TITLE);
14
15 DLL_MAIN_WINDOW_CLASS = 'TfrmVA508HiddenJawsMainWindow';
16 DLL_WINDOW_TITLE = 'VA 508 JAWS Window';
17 DLL_WINDOW_TITLE_LEN = length(DLL_WINDOW_TITLE);
18
19// format = prefix : varname : <index #> : +/- <data>
20 DLL_WINDOW_DELIM = ':';
21 DLL_WINDOW_OFFSET = '=';
22 DLL_WINDOW_LENGTH = ',';
23
24 DLL_CAPTION_MAX = 4090; // max num of chars per title
25 MAX_CHARS_IN_WINDOW_HANDLE = 12;
26 DLL_CAPTION_LIMIT = DLL_CAPTION_MAX - MAX_CHARS_IN_WINDOW_HANDLE;
27
28 DLL_DATA_WINDOW_CLASS = 'TfrmVA508HiddenJawsDataWindow';
29
30 JAWS_MESSAGE_GET_DLL_WITH_FOCUS = 1;
31
32var
33 MessageID: UINT = 0;
34
35procedure ErrorCheckClassName(obj: TObject; ClassName: string);
36procedure SendReturnValue(Window: HWND; Value: Longint);
37
38implementation
39
40uses VAUtils;
41
42procedure ErrorCheckClassName(obj: TObject; ClassName: string);
43begin
44 if obj.ClassName <> ClassName then
45 Raise Exception.Create(obj.ClassName + ' should have been ' + ClassName);
46end;
47
48procedure SendReturnValue(Window: HWND; Value: Longint);
49var
50 idx1, idx2: integer;
51 header: string;
52 bump: byte;
53begin
54 header := GetWindowTitle(Window);
55 idx1 := pos(':', header);
56 if idx1 < 1 then
57 idx1 := length(header) + 1;
58 idx2 := posex(':', header, idx1+1);
59 if idx2<=idx1 then
60 idx2 := idx1+1;
61 bump := StrToIntDef(copy(header, idx1+1, idx2 - idx1 - 1), 0);
62 if bump > 254 then
63 bump := 1
64 else
65 inc(bump);
66 header := copy(header,1,idx1-1) + ':' + inttostr(bump) + ':' + IntToStr(Value);
67 SetWindowText(Window, PChar(header));
68end;
69
70procedure InitializeCommonData;
71begin
72 MessageID := RegisterWindowMessage(DLL_MESSAGE_ID_NAME);
73end;
74
75initialization
76 InitializeCommonData;
77
78finalization
79
80end.
Note: See TracBrowser for help on using the repository browser.