source: trunk/dll/gotchdll.c@ 27

Last change on this file since 27 was 27, checked in by Gregg Young, 8 years ago

Remove mmio code; Ticet #5 Get gotcha "quiet" version working Tickets #1 #7 #9 Dialog changes related to both "quiet" and regular modes ( dialogs still need to be split in order to build both; only "quite can be bult from this) See Ticket #9 for a more complete list of changes.

  • Property svn:eol-style set to native
File size: 2.5 KB
RevLine 
[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]31HAB habDLL;
32HWND hwndFrame;
33HMODULE hMod;
34
35void EXPENTRY InitDLL (HAB hab, HWND hwnd)
36{
37 habDLL = hab;
38 hwndFrame = hwnd;
[27]39 DosLoadModule (NULL, 0, "GOTCHDLL", &hMod);
[2]40}
41
[27]42BOOL 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]79void EXPENTRY StartInputHook (void)
80{
[27]81 WinSetHook (habDLL, NULLHANDLE, HK_PREACCEL, (PFN) InputProc, hMod);
[2]82}
83
84void EXPENTRY StopInputHook (void)
85{
[27]86 WinReleaseHook (habDLL, NULLHANDLE, HK_PREACCEL, (PFN) InputProc, hMod);
[2]87 DosFreeModule (hMod);
88}
89
90USHORT Version (VOID)
91{
92 return 1;
93}
Note: See TracBrowser for help on using the repository browser.