source: trunk/dll/gotchdll.c@ 41

Last change on this file since 41 was 41, checked in by Gregg Young, 7 years ago

Fix hang on non-full screen capture of window with a menu open; Fix failure of widow to come to the top when program set as always on top are running. Add part of window title to auto file names; Major overhaul of settings dialog for Gotcha Quiet. More _QUIET_ ifdefs added to split code where Gotcha and Gotcha Quiet differ.

  • Property svn:eol-style set to native
File size: 2.8 KB
Line 
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
25//#define __PMPRINTF__
26//#include "PMPRINTF.H"
27
28/* pre-accelerator input hook, undocumented, */
29#define HK_PREACCEL 17
30
31HAB habDLL;
32HWND hwndFrame;
33HMODULE hMod;
34
35void EXPENTRY InitDLL (HAB hab, HWND hwnd)
36{
37 habDLL = hab;
38 hwndFrame = hwnd;
39 DosLoadModule (NULL, 0, "GOTCHDLL", &hMod);
40}
41
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 (usFlags & KC_CTRL)) {
70 if (usFlags & KC_KEYUP) {
71 WinPostMsg (hwndFrame, WM_COMMAND,
72 MPFROM2SHORT (WID_PB_SETCAPTURETYPE,0), MPFROMLONG(1));
73 return TRUE;
74 }
75
76 }
77 else if ((usScan == VK_PRINTSCRN || CHAR4FROMMP(pqmsg->mp1) == 93 )) {
78 if (usFlags & KC_KEYUP) {
79 WinPostMsg (hwndFrame, WM_COMMAND,
80 MPFROM2SHORT (WID_PB_SETCAPTURETYPE,0), 0);
81 return TRUE;
82 }
83
84 }
85 return FALSE;
86}
87
88void EXPENTRY StartInputHook (void)
89{
90 WinSetHook (habDLL, NULLHANDLE, HK_PREACCEL, (PFN) InputProc, hMod);
91}
92
93void EXPENTRY StopInputHook (void)
94{
95 WinReleaseHook (habDLL, NULLHANDLE, HK_PREACCEL, (PFN) InputProc, hMod);
96 DosFreeModule (hMod);
97}
98
99USHORT Version (VOID)
100{
101 return 1;
102}
Note: See TracBrowser for help on using the repository browser.