程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> C語言 >> VC >> 關於VC++ >> VC如何獲取系統所用的語言

VC如何獲取系統所用的語言

編輯:關於VC++

LANGID langid = GetSystemDefaultLangID();

//例如:2052

langid = GetUserDefaultLangID();

//例如:2052

CString msgFile;

msgFile.Format(_T("%04xl"),langid);

//例如:0804

TCHAR name[4*1024]={0};

GetLocaleInfo(LOCALE_SYSTEM_DEFAULT, LOCALE_SNATIVELANGNAME,

name, sizeof(name)/sizeof(TCHAR));

//例如:中文(簡體)

LCID lcid=GetSystemDefaultLCID();

//例如:2052

UINT acp=GetACP();

//例如:936

HINSTANCE m_hLangDLL = NULL;

WORD wLangID=PRIMARYLANGID(::GetSystemDefaultLangID());

 

switch(wLangID)

{

case LANG_CHINESE:

m_hLangDLL=AfxLoadLibrary(_T( "Chinese.DLL "));

break;

default:

m_hLangDLL=AfxLoadLibrary(_T( "English.DLL "));

break;

}

if(!m_hLangDLL)

{

AfxMessageBox(_T( "Unable to load resource DLL!\n\rUse self-resource! "));

}

else

{

AfxSetResourceHandle(m_hLangDLL);

}

FreeLibrary(m_hLangDLL);

相關定義參考:WinNT.h

//

// Language IDs.

//

// The following two combinations of primary language ID and

// sublanguage ID have special semantics:

//

// Primary Language ID Sublanguage ID Result

// ------------------- --------------- ------------------------

// LANG_NEUTRAL SUBLANG_NEUTRAL Language neutral

// LANG_NEUTRAL SUBLANG_DEFAULT User default language

// LANG_NEUTRAL SUBLANG_SYS_DEFAULT System default language

// LANG_INVARIANT SUBLANG_NEUTRAL Invariant locale

//

//

// Primary language IDs.

//

#define LANG_NEUTRAL 0x00

#define LANG_INVARIANT 0x7f

#define LANG_AFRIKAANS 0x36

#define LANG_ALBANIAN 0x1c

#define LANG_ARABIC 0x01

#define LANG_ARMENIAN 0x2b

#define LANG_ASSAMESE 0x4d

#define LANG_AZERI 0x2c

#define LANG_BASQUE 0x2d

#define LANG_BELARUSIAN 0x23

#define LANG_BENGALI 0x45

#define LANG_BULGARIAN 0x02

#define LANG_CATALAN 0x03

#define LANG_CHINESE 0x04

#define LANG_CROATIAN 0x1a

#define LANG_CZECH 0x05

#define LANG_DANISH 0x06

#define LANG_DIVEHI 0x65

#define LANG_DUTCH 0x13

#define LANG_ENGLISH 0x09

#define LANG_ESTONIAN 0x25

#define LANG_FAEROESE 0x38

#define LANG_FARSI 0x29

#define LANG_FINNISH 0x0b

#define LANG_FRENCH 0x0c

#define LANG_GALICIAN 0x56

#define LANG_GEORGIAN 0x37

#define LANG_GERMAN 0x07

#define LANG_GREEK 0x08

#define LANG_GUJARATI 0x47

#define LANG_HEBREW 0x0d

#define LANG_HINDI 0x39

#define LANG_HUNGARIAN 0x0e

#define LANG_ICELANDIC 0x0f

#define LANG_INDONESIAN 0x21

#define LANG_ITALIAN 0x10

#define LANG_JAPANESE 0x11

#define LANG_KANNADA 0x4b

#define LANG_KASHMIRI 0x60

#define LANG_KAZAK 0x3f

#define LANG_KONKANI 0x57

#define LANG_KOREAN 0x12

#define LANG_KYRGYZ 0x40

#define LANG_LATVIAN 0x26

#define LANG_LITHUANIAN 0x27

#define LANG_MACEDONIAN 0x2f // the Former Yugoslav Republic of Macedonia

#define LANG_MALAY 0x3e

#define LANG_MALAYALAM 0x4c

#define LANG_MANIPURI 0x58

#define LANG_MARATHI 0x4e

#define LANG_MONGOLIAN 0x50

#define LANG_NEPALI 0x61

#define LANG_NORWEGIAN 0x14

#define LANG_ORIYA 0x48

#define LANG_POLISH 0x15

#define LANG_PORTUGUESE 0x16

#define LANG_PUNJABI 0x46

#define LANG_ROMANIAN 0x18

#define LANG_RUSSIAN 0x19

#define LANG_SANSKRIT 0x4f

#define LANG_SERBIAN 0x1a

#define LANG_SINDHI 0x59

#define LANG_SLOVAK 0x1b

#define LANG_SLOVENIAN 0x24

#define LANG_SPANISH 0x0a

#define LANG_SWAHILI 0x41

#define LANG_SWEDISH 0x1d

#define LANG_SYRIAC 0x5a

#define LANG_TAMIL 0x49

#define LANG_TATAR 0x44

#define LANG_TELUGU 0x4a

#define LANG_THAI 0x1e

#define LANG_TURKISH 0x1f

#define LANG_UKRAINIAN 0x22

#define LANG_URDU 0x20

#define LANG_UZBEK 0x43

#define LANG_VIETNAMESE 0x2a

//

// Sublanguage IDs.

//

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved