GetKBCodePage

3.0

  int GetKBCodePage(void)    

The GetKBCodePage function returns the current Windows code page.

Parameters

This function has no parameters.

Return Value

The return value specifies the code page currently loaded by Windows, if the function is successful. It can be one of the following values:

Value Meaning

437 Default (United States, used by most countries: indicates that there is no OEMANSI.BIN in the Windows directory)
850 International (OEMANSI.BIN = XLAT850.BIN)
860 Portugal (OEMANSI.BIN = XLAT860.BIN)
861 Iceland (OEMANSI.BIN = XLAT861.BIN)
863 French Canadian (OEMANSI.BIN = XLAT863.BIN)
865 Norway/Denmark (OEMANSI.BIN = XLAT865.BIN)

Comments

The keyboard driver provides the GetKBCodePage function. An application using this function must include the following information in its module-definition (.DEF) file:

IMPORTS
    KEYBOARD.GETKBCODEPAGE

If the OEMANSI.BIN file is in the Windows directory, Windows reads it and overwrites the OEM/ANSI translation tables in the keyboard driver.

When the user selects a language from the Setup program and the language does not use the default code page (437), Setup copies the appropriate file (such as XLAT850.BIN) to OEMANSI.BIN in the Windows system directory. If the language uses the default code page, Setup deletes OEMANSI.BIN, if it exists, from the Windows system directory.

Example

The following example uses the GetKBCodePage function to display the current code page:

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);

See Also

GetKeyboardType