[829] | 1 | unit JAWSCommon;
|
---|
| 2 |
|
---|
| 3 | interface
|
---|
| 4 |
|
---|
| 5 | uses
|
---|
| 6 | SysUtils, Windows, Messages, Registry, StrUtils;
|
---|
| 7 |
|
---|
| 8 | const
|
---|
| 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 |
|
---|
| 32 | var
|
---|
| 33 | MessageID: UINT = 0;
|
---|
| 34 |
|
---|
| 35 | procedure ErrorCheckClassName(obj: TObject; ClassName: string);
|
---|
| 36 | procedure SendReturnValue(Window: HWND; Value: Longint);
|
---|
| 37 |
|
---|
| 38 | implementation
|
---|
| 39 |
|
---|
| 40 | uses VAUtils;
|
---|
| 41 |
|
---|
| 42 | procedure ErrorCheckClassName(obj: TObject; ClassName: string);
|
---|
| 43 | begin
|
---|
| 44 | if obj.ClassName <> ClassName then
|
---|
| 45 | Raise Exception.Create(obj.ClassName + ' should have been ' + ClassName);
|
---|
| 46 | end;
|
---|
| 47 |
|
---|
| 48 | procedure SendReturnValue(Window: HWND; Value: Longint);
|
---|
| 49 | var
|
---|
| 50 | idx1, idx2: integer;
|
---|
| 51 | header: string;
|
---|
| 52 | bump: byte;
|
---|
| 53 | begin
|
---|
| 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));
|
---|
| 68 | end;
|
---|
| 69 |
|
---|
| 70 | procedure InitializeCommonData;
|
---|
| 71 | begin
|
---|
| 72 | MessageID := RegisterWindowMessage(DLL_MESSAGE_ID_NAME);
|
---|
| 73 | end;
|
---|
| 74 |
|
---|
| 75 | initialization
|
---|
| 76 | InitializeCommonData;
|
---|
| 77 |
|
---|
| 78 | finalization
|
---|
| 79 |
|
---|
| 80 | end.
|
---|