HOWTO: Determine Default Language ID of Windows 95 or WinNT

Last reviewed: February 25, 1998
Article ID: Q181604
The information in this article applies to:
  • Microsoft Win32 Software Development Kit (SDK)

SUMMARY

Some applications need to get the operating system's language ID. GetSystemDefaultLangID doesn't work, because the user can change it in the Control Panel.

For example, on English Windows 95, the user opens Control Panel, clicks Regional Settings, and changes the setting from English US to French France in the Regional Settings Properties dialog box. As a result, GetSystemDefaultLangID changes to French too. On Windows NT, the user clicks Control Panel, clicks Regional Settings, and opens the Regional Settings Properties dialog box. In the Regional Settings Properties dialog box, the user selects a different Locale in a different language, selects the "Set as system default locale" check box, and then restarts the computer. As a result GetSystemDefaultLangID changes too the new language too.

This article explains more reliable methods you can use to get the installed operating system's language ID.

MORE INFORMATION

The following methods are available to get the installed operating system's language ID:

  • Under Windows 95, retrieve the installed operating system's Locale ID from HKEY_CURRENT_USER\Control Panel\desktop\ResourceLocale (HKEY_USERS\.Default\Control Panel\desktop\ResourceLocale. Use LANGIDFROMLCID to retrieve the Language ID value from the Locale value.

    NOTE: This key does not exist under Windows NT, therefore, this method does not work under Windows NT.

  • Under Windows NT 4.0 and Windows 95 (only Windows 95 installations that have turned on user profile), retrieve the installed operating system's Locale ID from HKEY_USERS\.DEFAULT\Control Panel\International. Then get the Language ID from the LCID.

    NOTE: This method only works under Windows 95 after user profile has been turned on. Otherwise, it does not work under Windows 95.

  • Under both Windows NT and Windows 95, you can get the language information in the FileVersionInfo of User.exe by calling GetFileVersionInfo, and then VerQueryValue (on \\VarFileInfo\\Translation") on the VersionInfo block of the operating system's User.exe.

    NOTE: This method is the most reliable. It works well under both Windows NT and Windows 95. This method also works for Windows 3.1.

Keywords          : KBIntlDev
Version           : WINNT:4.0;WIN95
Platform          : Win95 winnt
Issue type        : kbinfo


================================================================================


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 25, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.