int GetKeyboardType(fnKeybInfo) | |||||
int fnKeybInfo; | /* specifies type of information to retrieve | */ |
The GetKeyboardType function retrieves information about the current keyboard.
fnKeybInfo
Determines the type of keyboard information to be retrieved. This parameter can be one of the following values:
Value | Meaning |
0 | Retrieves the keyboard type. |
1 | Retrieves the keyboard subtype. |
2 | Retrieves the number of function keys on the keyboard. |
The return value specifies the requested information if the function is successful. Otherwise, it is zero.
The subtype is an OEM-dependent value. The subtype may be one of the following values:
Value | Meaning |
1 | IBM PC/XT, or compatible (83-key) keyboard |
2 | Olivetti “ICO” (102-key) keyboard |
3 | IBM AT (84-key) or similar keyboard |
4 | IBM Enhanced (101- or 102-key) keyboard |
5 | Nokia 1050 and similar keyboards |
6 | Nokia 9140 and similar keyboards |
7 | Japanese keyboard |
The keyboard driver provides the GetKeyboardType function. An application using this function must include the following information in its module-definition (.DEF) file:
IMPORTS
KEYBOARD.GETKEYBOARDTYPE
The application can also determine the number of function keys on a keyboard from the keyboard type. The number of function keys for each keyboard type follows:
Type | Number of function keys |
1 | 10 |
2 | 12 (sometimes 18) |
3 | 10 |
4 | 12 |
5 | 10 |
6 | 24 |
7 | This value is hardware-dependent and must be specified by the OEM. |
The following example uses the GetKeyboardType function to display information about the current keyboard:
char szBuf[80];
int i, cp, subtype, f_keys, len;
char *apszKeyboards[] = {
"IBM PX/XT",
"Olivetti ICO",
"IBM AT",
"IBM Enhanced",
"Nokia 1050",
"Nokia 9140",
"Standard Japanese",
};
cp = GetKBCodePage();
if ((i = GetKeyboardType(0)) == 0 || i > 7) {
MessageBox(NULL, "invalid keyboard type",
"GetKeyboardType", MB_ICONSTOP);
break;
}
subtype = GetKeyboardType(1);
f_keys = GetKeyboardType(2);
len = wsprintf(szBuf, "%s keyboard, subtype %d\n",
apszKeyboards[i - 1], subtype);
len = wsprintf(szBuf + len, " %d function keys, code page %d",
f_keys, cp);
MessageBox(NULL, szBuf, "Keyboard Information", MB_OK);