1 static char RCSId
[] = "$Id: keyboard.c,v 1.2 1993/09/13 18:52:02 scott Exp $";
2 static char Copyright
[] = "Copyright Scott A. Laird, 1993";
6 #include "prototypes.h"
9 int ToAscii(WORD wVirtKey
, WORD wScanCode
, LPSTR lpKeyState
,
10 LPVOID lpChar
, WORD wFlags
)
12 printf("ToAscii (%d,%d)\n",wVirtKey
, wScanCode
);
18 int AnsiToOem(LPSTR lpAnsiStr
, LPSTR lpOemStr
)
20 printf("AnsiToOem (%s)\n",lpAnsiStr
);
21 strcpy(lpOemStr
,lpAnsiStr
); /* Probably not the right thing to do, but... */
25 BOOL
OemToAnsi(LPSTR lpOemStr
, LPSTR lpAnsiStr
)
27 printf("OemToAnsi (%s)\n",lpOemStr
);
28 strcpy(lpAnsiStr
,lpOemStr
); /* Probably not the right thing to do, but... */
34 DWORD
OemKeyScan(WORD wOemChar
)
36 printf("*OemKeyScan (%d)\n",wOemChar
);
40 /* VkKeyScan translates an ANSI character to a virtual-key and shift code
41 * for the current keyboard. For now we return -1, which is fail. */
43 WORD
VkKeyScan(WORD cChar
)
45 printf("VkKeyScan (%d)\n",cChar
);
49 int GetKeyboardType(int nTypeFlag
)
51 printf("GetKeyboardType(%d)\n",nTypeFlag
);
54 case 0: /* Keyboard type */
55 return 4; /* AT-101 */
57 case 1: /* Keyboard Subtype */
58 return 0; /* There are no defined subtypes */
60 case 2: /* Number of F-keys */
61 return 12; /* We're doing an 101 for now, so return 12 F-keys */
64 printf(" Unknown type on GetKeyboardType\n");
65 return 0; /* The book says 0 here, so 0 */
69 /* MapVirtualKey translates keycodes from one format to another. This
72 WORD
MapVirtualKey(WORD wCode
, WORD wMapType
)
74 printf("*MapVirtualKey(%d,%d)\n",wCode
,wMapType
);
78 int GetKbCodePage(void)
80 printf("GetKbCodePage()\n");
81 return 437; /* US -- probably should be 850 from time to time */
84 /* This should distinguish key names. Maybe later */
86 int GetKeyNameText(LONG lParam
, LPSTR lpBuffer
, int nSize
)
88 printf("GetKeyNameText(%d,<ptr>, %d)\n",lParam
,nSize
);
89 lpBuffer
[0]=0; /* This key has no name */
95 void AnsiToOemBuff(LPSTR lpAnsiStr
, LPSTR lpOemStr
, int nLength
)
97 printf("AnsiToOemBuff(%s,<ptr>,%d)\n",lpAnsiStr
,nLength
);
98 strncpy(lpOemStr
,lpAnsiStr
,nLength
); /* should translate... */
101 void OemToAnsiBuff(LPSTR lpOemStr
, LPSTR lpAnsiStr
, int nLength
)
103 printf("OemToAnsiBuff(%s,<ptr>,%d)\n",lpOemStr
,nLength
);
104 strncpy(lpAnsiStr
,lpOemStr
,nLength
); /* should translate... */