MsoGetUILcid Function

Applies to: Office 2010

Returns the locale identifier (LCID) that is currently in use by Microsoft Office.

LCID __stdcall MsoGetUILcid (void);

Return Value

The locale identifier that is currently in use by Microsoft Office. If the function cannot find the locale identifier, or fails, it returns zero.

Remarks

The locale identifier indicates which language settings are currently in use in Microsoft Office. You can use the locale identifier so that the user interface of your application uses the same locale as Microsoft Office. For more information about locales, see Locales and Languages.

Requirements

Minimum supported application

2007 Microsoft Office system

Header

None

Library

None

DLL

Mso.dll

Example

The following example demonstrates how to call the MsoGetUILcid function if Mso.dll is installed in the C:\Program Files\Common Files\Microsoft Shared\Office12\ folder.

#include "stdafx.h"
#include "windows.h"

typedef LCID (__stdcall *PfnMsoGetUILcid) (void);

int _tmain(int argc, _TCHAR* argv[])
{
      LCID lcid = 0;
      PfnMsoGetUILcid pfnMsoGetUILcid = NULL;
      HMODULE hModule = LoadLibraryW(L"C:\\Program Files\\Common Files\\microsoft shared\\OFFICE12\\mso.dll");
      if (hModule)
      {
            pfnMsoGetUILcid = (PfnMsoGetUILcid) GetProcAddress(hModule, "_MsoGetUILcid@0");
            if (pfnMsoGetUILcid)
            {
                  lcid = pfnMsoGetUILcid();
                  printf("_MsoGetUILcid@0 returned %d \r\n", lcid);
            }
            // This ordinal value is correct only for the 2007 Microsoft Office system.
            pfnMsoGetUILcid = (PfnMsoGetUILcid) GetProcAddress(hModule, (LPCSTR)1378);
            if (pfnMsoGetUILcid)
            {
                  lcid = pfnMsoGetUILcid();
                  printf("Ordinal function 1378 returned %d \r\n", lcid);
            }
      }
      return 0;
}

See Also

Concepts

Component API Functions