source: trunk/synergy/lib/platform/CPMUtil.h

Last change on this file was 2768, checked in by bird, 19 years ago

Expanded m_client to 64-bit. Finally managed to hack together a getKeyMap and fakeKey for PM.

File size: 2.9 KB
Line 
1/*
2 * synergy -- mouse and keyboard sharing utility
3 * Copyright (C) 2004 Chris Schoeneman
4 * Copyright (C) 2006 Knut St. Osmundsen
5 *
6 * This package is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * found in the file COPYING that should have accompanied this file.
9 *
10 * This package 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
16#ifndef CPMUTIL_H
17#define CPMUTIL_H
18
19#include "CString.h"
20#define INCL_BASE
21#define INCL_ERRORS
22#define INCL_PM
23#include <os2.h>
24
25class CPMUtil {
26public:
27 //! Get message string
28 /*!
29 Gets a string for \p id from the string table of \p instance.
30 */
31 static CString getString(HMODULE hmod, ULONG id);
32
33 //! Get error string
34 /*!
35 Gets a system error message for \p error. If the error cannot be
36 found return the string for \p id, replacing ${1} with \p error.
37 */
38 static CString getErrorString(HMODULE hmod, ULONG error, ULONG id);
39
40 static HAB getHAB(void);
41 static HMQ getHMQ(HAB hab = NULLHANDLE);
42
43};
44
45/** The WinTranlateChar2 operation. */
46typedef enum WINTCOP
47{
48 TC_CHARTOSCANCODE = 0,
49 TC_SCANCODETOCHAR,
50 TC_VIRTUALKEYTOSCANCODE,
51 TC_SCANCODETOVIRTUALKEY,
52 TC_SCANTOOEMSCAN,
53 TC_OEMSCANTOSCAN,
54 TC_SIZE_HACK = 0x7fff
55} WINTCOP;
56
57/** @name WinTranslateChar2 shift state.
58 * This state goes with scancode input/output.
59 * @{ */
60#define TCF_LSHIFT 0x1
61#define TCF_RSHIFT 0x2
62#define TCF_SHIFT (TCF_LSHIFT | TCF_RSHIFT)
63#define TCF_LCONTROL 0x4
64#define TCF_RCONTROL 0x8
65#define TCF_CONTROL (TCF_LCONTROL | TCF_RCONTROL)
66#define TCF_ALT 0x10
67#define TCF_ALTGR 0x20
68#define TCF_CAPSLOCK 0x40
69#define TCF_NUMLOCK 0x80
70#define TCF_MAX_BITS 8 /**< bits 0-7 are real shift states */
71#define TCF_OEMSCANCODE 0x100
72#define TCF_EXTENDEDKEY 0x200
73/** @} */
74
75/**
76 * Char to/from keyboard code translator.
77 *
78 * @returns A combination of some of the KC_* values.
79 * @param usCodePage The code page. Anything goes, apparently ignored.
80 * @param pusCharInOut Where to get the char/code to be translated and to
81 * put the output upon return.
82 * @param pulDeadKeyInfo Previous, dead key.
83 * @param enmOperation The kind of translation.
84 * @param pfShiftState Where to read/store the shift state. Used when
85 * translating from/to scancodes.
86 * @remark PMWIN.1070
87 */
88extern "C"
89USHORT APIENTRY WinTranslateChar2(USHORT usCodePage,
90 PUSHORT pusCharInOut,
91 PULONG pulDeadKeyInfo,
92 WINTCOP enmOperation,
93 PUSHORT pfShiftState);
94
95#endif
96
Note: See TracBrowser for help on using the repository browser.