[2] | 1 | /***
|
---|
| 2 | This file belongs to the Gotcha! distribution.
|
---|
| 3 | Copyright (C) 1998-2002 Thorsten Thielen <thth@c2226.de>
|
---|
| 4 |
|
---|
| 5 | This program is free software; you can redistribute it and/or modify
|
---|
| 6 | it under the terms of the GNU General Public License as published by
|
---|
| 7 | the Free Software Foundation; either version 2 of the License, or
|
---|
| 8 | (at your option) any later version.
|
---|
| 9 |
|
---|
| 10 | This program is distributed in the hope that it will be useful,
|
---|
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 13 | GNU General Public License for more details.
|
---|
| 14 |
|
---|
| 15 | You should have received a copy of the GNU General Public License
|
---|
| 16 | along with this program; if not, write to the Free Software
|
---|
| 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
| 18 | ***/
|
---|
| 19 |
|
---|
| 20 | #define INCL_WIN
|
---|
| 21 | #define INCL_DOS
|
---|
| 22 | #include <os2.h>
|
---|
| 23 | #include "../id.h"
|
---|
| 24 |
|
---|
[27] | 25 | //#define __PMPRINTF__
|
---|
| 26 | //#include "PMPRINTF.H"
|
---|
| 27 |
|
---|
| 28 | /* pre-accelerator input hook, undocumented, */
|
---|
| 29 | #define HK_PREACCEL 17
|
---|
| 30 |
|
---|
[2] | 31 | HAB habDLL;
|
---|
| 32 | HWND hwndFrame;
|
---|
| 33 | HMODULE hMod;
|
---|
| 34 |
|
---|
| 35 | void EXPENTRY InitDLL (HAB hab, HWND hwnd)
|
---|
| 36 | {
|
---|
| 37 | habDLL = hab;
|
---|
| 38 | hwndFrame = hwnd;
|
---|
[27] | 39 | DosLoadModule (NULL, 0, "GOTCHDLL", &hMod);
|
---|
[2] | 40 | }
|
---|
| 41 |
|
---|
[27] | 42 | BOOL EXPENTRY InputProc (HAB hab, PQMSG pqmsg, ULONG ul)
|
---|
| 43 | {
|
---|
| 44 | USHORT usFlags;
|
---|
| 45 | USHORT usScan;
|
---|
| 46 |
|
---|
| 47 | if (pqmsg->msg != WM_CHAR
|
---|
| 48 | || (usFlags = SHORT1FROMMP(pqmsg->mp1), usScan =
|
---|
| 49 | SHORT2FROMMP (pqmsg->mp2), (usFlags & KC_SCANCODE)) == 0){
|
---|
| 50 | return FALSE;
|
---|
| 51 | }
|
---|
| 52 |
|
---|
| 53 | if (CHAR4FROMMP(pqmsg->mp1) == 0x54 ) {
|
---|
| 54 | if (usFlags & KC_KEYUP) {
|
---|
| 55 | WinPostMsg (hwndFrame, WM_COMMAND,
|
---|
| 56 | MPFROM2SHORT (WID_PB_SETTINGS,0), 0);
|
---|
| 57 | /*DosBeep( 1000, 10 );
|
---|
| 58 | DosBeep( 2000, 20 );
|
---|
| 59 | DosBeep( 3000, 30 ); */
|
---|
| 60 | return TRUE;
|
---|
| 61 | } else {
|
---|
| 62 | /* DosBeep( 3000, 30 );
|
---|
| 63 | DosBeep( 2000, 20 );
|
---|
| 64 | DosBeep( 1000, 10 );*/
|
---|
| 65 | return TRUE;
|
---|
| 66 | }
|
---|
| 67 | }
|
---|
| 68 | else if (usScan == VK_PRINTSCRN || CHAR4FROMMP(pqmsg->mp1) == 93 ) {
|
---|
| 69 | if (usFlags & KC_KEYUP) {
|
---|
| 70 | WinPostMsg (hwndFrame, WM_COMMAND,
|
---|
| 71 | MPFROM2SHORT (WID_PB_SETCAPTURETYPE,0), 0);
|
---|
| 72 | return TRUE;
|
---|
| 73 | }
|
---|
| 74 |
|
---|
| 75 | }
|
---|
| 76 | return FALSE;
|
---|
| 77 | }
|
---|
| 78 |
|
---|
[2] | 79 | void EXPENTRY StartInputHook (void)
|
---|
| 80 | {
|
---|
[27] | 81 | WinSetHook (habDLL, NULLHANDLE, HK_PREACCEL, (PFN) InputProc, hMod);
|
---|
[2] | 82 | }
|
---|
| 83 |
|
---|
| 84 | void EXPENTRY StopInputHook (void)
|
---|
| 85 | {
|
---|
[27] | 86 | WinReleaseHook (habDLL, NULLHANDLE, HK_PREACCEL, (PFN) InputProc, hMod);
|
---|
[2] | 87 | DosFreeModule (hMod);
|
---|
| 88 | }
|
---|
| 89 |
|
---|
| 90 | USHORT Version (VOID)
|
---|
| 91 | {
|
---|
| 92 | return 1;
|
---|
| 93 | }
|
---|