本文整理汇总了C++中MAKELCID函数的典型用法代码示例。如果您正苦于以下问题:C++ MAKELCID函数的具体用法?C++ MAKELCID怎么用?C++ MAKELCID使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MAKELCID函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getJavaIDFromLangID
// Returns BCP47 Language Tag
DllExport const char *
getJavaIDFromLangID(LANGID langID)
{
char * elems[5]; // lang, script, ctry, variant, encoding
char * ret = malloc(SNAMESIZE);
int index;
SetupI18nProps(MAKELCID(langID, SORT_DEFAULT),
&(elems[0]), &(elems[1]), &(elems[2]), &(elems[3]), &(elems[4]));
// there always is the "language" tag
strcpy(ret, elems[0]);
// append other elements, if any
for (index = 1; index < 4; index++) {
if ((elems[index])[0] != '\0') {
strcat(ret, "-");
strcat(ret, elems[index]);
}
}
for (index = 0; index < 5; index++) {
free(elems[index]);
}
return ret;
}
示例2: FillCombo
void FillCombo(HWND hwnd, int id, int indexSettings)
{
HKL saved = SettingsGlobal().hkl_lay[indexSettings];
bool found = false;
for (int i = 0; i < g_laySize; i++)
{
HKL cur = g_laylist[i];
WORD langid = LOWORD(cur);
TCHAR buf[512]; buf[0] = 0;
int flag = IsWindowsVistaOrGreater() ? LOCALE_SNAME : LOCALE_SLANGUAGE;
int len = GetLocaleInfo(MAKELCID(langid, SORT_DEFAULT), flag, buf, 512);
SW_WINBOOL_LOG(len != 0);
SendDlgItemMessage(hwnd, id, CB_ADDSTRING, 0, (LPARAM)buf);
if (saved == cur)
{
found = true;
SendDlgItemMessage(hwnd, id, CB_SETCURSEL, (WPARAM)i, (LPARAM)0);
}
}
if(!found)
{
SendDlgItemMessage(hwnd, id, CB_SETCURSEL, (WPARAM)0, (LPARAM)0);
}
}
示例3: GBKToGB2312
CP_CONVERTER_API int GBKToGB2312(LPCSTR lpMultiByteStrSrc, int cbMultiByteSrc, LPSTR lpMultiByteStrDst, int cbMultiByteDst)
{
DWORD dwLCID = MAKELCID(MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED), SORT_CHINESE_BIG5);
int nResult = 0;
nResult = ::LCMapString(dwLCID, LCMAP_SIMPLIFIED_CHINESE, lpMultiByteStrSrc, cbMultiByteSrc, lpMultiByteStrDst, cbMultiByteDst);
return nResult;
}
示例4: _get_lc_lconv
/*
* Get the lconv fields.
*/
static int __cdecl _get_lc_lconv (
struct lconv *l
)
{
int ret = 0;
/* Currency is country--not language--dependent. NT work-around. */
LCID ctryid=MAKELCID(__lc_id[LC_MONETARY].wCountry, SORT_DEFAULT);
if (l == NULL)
return -1;
ret |= __getlocaleinfo(LC_STR_TYPE, ctryid, LOCALE_SINTLSYMBOL, (void *)&l->int_curr_symbol);
ret |= __getlocaleinfo(LC_STR_TYPE, ctryid, LOCALE_SCURRENCY, (void *)&l->currency_symbol);
ret |= __getlocaleinfo(LC_STR_TYPE, ctryid, LOCALE_SMONDECIMALSEP, (void *)&l->mon_decimal_point);
ret |= __getlocaleinfo(LC_STR_TYPE, ctryid, LOCALE_SMONTHOUSANDSEP, (void *)&l->mon_thousands_sep);
ret |= __getlocaleinfo(LC_STR_TYPE, ctryid, LOCALE_SMONGROUPING, (void *)&l->mon_grouping);
fix_grouping(l->mon_grouping);
ret |= __getlocaleinfo(LC_STR_TYPE, ctryid, LOCALE_SPOSITIVESIGN, (void *)&l->positive_sign);
ret |= __getlocaleinfo(LC_STR_TYPE, ctryid, LOCALE_SNEGATIVESIGN, (void *)&l->negative_sign);
ret |= __getlocaleinfo(LC_INT_TYPE, ctryid, LOCALE_IINTLCURRDIGITS, (void *)&l->int_frac_digits);
ret |= __getlocaleinfo(LC_INT_TYPE, ctryid, LOCALE_ICURRDIGITS, (void *)&l->frac_digits);
ret |= __getlocaleinfo(LC_INT_TYPE, ctryid, LOCALE_IPOSSYMPRECEDES, (void *)&l->p_cs_precedes);
ret |= __getlocaleinfo(LC_INT_TYPE, ctryid, LOCALE_IPOSSEPBYSPACE, (void *)&l->p_sep_by_space);
ret |= __getlocaleinfo(LC_INT_TYPE, ctryid, LOCALE_INEGSYMPRECEDES, (void *)&l->n_cs_precedes);
ret |= __getlocaleinfo(LC_INT_TYPE, ctryid, LOCALE_INEGSEPBYSPACE, (void *)&l->n_sep_by_space);
ret |= __getlocaleinfo(LC_INT_TYPE, ctryid, LOCALE_IPOSSIGNPOSN, (void *)&l->p_sign_posn);
ret |= __getlocaleinfo(LC_INT_TYPE, ctryid, LOCALE_INEGSIGNPOSN, (void *)&l->n_sign_posn);
return ret;
}
示例5: MyGetLocaleInfoA
/*------------------------------------------------
get locale information by ANSI
--------------------------------------------------*/
int MyGetLocaleInfoA(int ilang, int codepage,
LCTYPE lctype, char* dst, int n)
{
int r;
LCID locale;
*dst = 0;
locale = MAKELCID((WORD)ilang, SORT_DEFAULT);
if(GetVersion() & 0x80000000) // 95/98/Me
r = GetLocaleInfoA(locale, lctype, dst, n);
else // NT4/2000/XP
{
WCHAR buf[80];
r = GetLocaleInfoW(locale, lctype, buf, 80);
if(r)
{
int codepage = GetCodePage(GetUserDefaultLangID());
r = WideCharToMultiByte(codepage, 0, buf, -1, dst, n,
NULL, NULL);
}
}
return r;
}
示例6: MAKELCID
//
// Convert TAutoVal to TUString, used by TAutoString contructor and assignment
//
TAutoVal::operator TUString*()
{
BSTR v;
HRESULT stat;
LCID lcid = MAKELCID(LangUserDefault, SORT_DEFAULT);
switch (vt) {
case atByte: stat = ::VarBstrFromUI1(bVal, lcid,0, &v); break;
case atShort: stat = ::VarBstrFromI2(iVal, lcid,0, &v); break;
case atLong: stat = ::VarBstrFromI4(lVal, lcid,0, &v); break;
case atFloat: stat = ::VarBstrFromR4(fltVal,lcid,0, &v); break;
case atDouble: stat = ::VarBstrFromR8(dblVal,lcid,0, &v); break;
case atCurrency: stat = ::VarBstrFromCy(cyVal ,lcid,0, &v); break;
case atDatetime: stat = ::VarBstrFromDate(date,lcid,0, &v); break;
case atString: if (bstrVal) vt = atLoanedBSTR;
return (s.Holder=TUString::Create(bstrVal, true, GetLanguage()));
case atObject: stat = ::VarBstrFromDisp(pdispVal,GetLocale(),0, &v); break;
case atBool: stat = ::VarBstrFromBool(boolVal,lcid,0, &v); break;
case atByRef+atByte: stat = ::VarBstrFromUI1(*pbVal, lcid,0, &v); break;
case atByRef+atShort: stat = ::VarBstrFromI2(*piVal, lcid,0, &v); break;
case atByRef+atLong: stat = ::VarBstrFromI4(*plVal, lcid,0, &v); break;
case atByRef+atFloat: stat = ::VarBstrFromR4(*pfltVal,lcid,0, &v); break;
case atByRef+atDouble: stat = ::VarBstrFromR8(*pdblVal,lcid,0, &v); break;
case atByRef+atCurrency: stat = ::VarBstrFromCy(*pcyVal ,lcid,0, &v); break;
case atByRef+atDatetime: stat = ::VarBstrFromDate(*pdate,lcid,0, &v); break;
case atByRef+atString: if (*pbstrVal) vt = atByRef+atLoanedBSTR;
return (s.Holder=TUString::Create(*pbstrVal, true, GetLanguage()));
case atByRef+atBool: stat = ::VarBstrFromBool(*pbool,lcid,0,&v);break;
default: stat = (HRESULT)-1;
}
if (stat != HR_NOERROR)
TXAuto::Raise(TXAuto::xConversionFailure);
return TUString::Create(v, false, LANGIDFROMLCID(lcid));
}
示例7: _gdk_windowing_init
void
_gdk_windowing_init (void)
{
gchar buf[10];
if (getenv ("GDK_IGNORE_WINTAB") != NULL)
_gdk_input_ignore_wintab = TRUE;
else if (getenv ("GDK_USE_WINTAB") != NULL)
_gdk_input_ignore_wintab = FALSE;
if (gdk_synchronize)
GdiSetBatchLimit (1);
_gdk_app_hmodule = GetModuleHandle (NULL);
_gdk_display_hdc = CreateDC ("DISPLAY", NULL, NULL, NULL);
_gdk_input_locale = GetKeyboardLayout (0);
_gdk_input_locale_is_ime = ImmIsIME (_gdk_input_locale);
GetLocaleInfo (MAKELCID (LOWORD (_gdk_input_locale), SORT_DEFAULT),
LOCALE_IDEFAULTANSICODEPAGE,
buf, sizeof (buf));
_gdk_input_codepage = atoi (buf);
GDK_NOTE (EVENTS, g_print ("input_locale:%p, codepage:%d\n",
_gdk_input_locale, _gdk_input_codepage));
CoInitialize (NULL);
_gdk_selection = gdk_atom_intern_static_string ("GDK_SELECTION");
_wm_transient_for = gdk_atom_intern_static_string ("WM_TRANSIENT_FOR");
_targets = gdk_atom_intern_static_string ("TARGETS");
_delete = gdk_atom_intern_static_string ("DELETE");
_save_targets = gdk_atom_intern_static_string ("SAVE_TARGETS");
_utf8_string = gdk_atom_intern_static_string ("UTF8_STRING");
_text = gdk_atom_intern_static_string ("TEXT");
_compound_text = gdk_atom_intern_static_string ("COMPOUND_TEXT");
_text_uri_list = gdk_atom_intern_static_string ("text/uri-list");
_text_html = gdk_atom_intern_static_string ("text/html");
_image_png = gdk_atom_intern_static_string ("image/png");
_image_jpeg = gdk_atom_intern_static_string ("image/jpeg");
_image_bmp = gdk_atom_intern_static_string ("image/bmp");
_image_gif = gdk_atom_intern_static_string ("image/gif");
_local_dnd = gdk_atom_intern_static_string ("LocalDndSelection");
_gdk_win32_dropfiles = gdk_atom_intern_static_string ("DROPFILES_DND");
_gdk_ole2_dnd = gdk_atom_intern_static_string ("OLE2_DND");
/* MS Office 2007, at least, offers images in common file formats
* using clipboard format names like "PNG" and "JFIF". So we follow
* the lead and map the GDK target name "image/png" to the clipboard
* format name "PNG" etc.
*/
_cf_png = RegisterClipboardFormat ("PNG");
_cf_jfif = RegisterClipboardFormat ("JFIF");
_cf_gif = RegisterClipboardFormat ("GIF");
_cf_url = RegisterClipboardFormat ("UniformResourceLocatorW");
_cf_html_format = RegisterClipboardFormat ("HTML Format");
_cf_text_html = RegisterClipboardFormat ("text/html");
_gdk_win32_selection_init ();
}
示例8: MAKELCID
void CGitPropertyPage::Time64ToTimeString(__time64_t time, TCHAR * buf, size_t buflen) const
{
struct tm newtime;
SYSTEMTIME systime;
LCID locale = LOCALE_USER_DEFAULT;
if (!CRegDWORD(_T("Software\\TortoiseGit\\UseSystemLocaleForDates"), TRUE))
locale = MAKELCID((WORD)CRegStdDWORD(_T("Software\\TortoiseGit\\LanguageID"), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT)), SORT_DEFAULT);
*buf = '\0';
if (time)
{
TCHAR timebuf[MAX_STRING_LENGTH] = { 0 };
TCHAR datebuf[MAX_STRING_LENGTH] = { 0 };
_localtime64_s(&newtime, &time);
systime.wDay = (WORD)newtime.tm_mday;
systime.wDayOfWeek = (WORD)newtime.tm_wday;
systime.wHour = (WORD)newtime.tm_hour;
systime.wMilliseconds = 0;
systime.wMinute = (WORD)newtime.tm_min;
systime.wMonth = (WORD)newtime.tm_mon+1;
systime.wSecond = (WORD)newtime.tm_sec;
systime.wYear = (WORD)newtime.tm_year+1900;
if (CRegStdDWORD(_T("Software\\TortoiseGit\\LogDateFormat")) == 1)
GetDateFormat(locale, DATE_SHORTDATE, &systime, NULL, datebuf, MAX_STRING_LENGTH);
else
GetDateFormat(locale, DATE_LONGDATE, &systime, NULL, datebuf, MAX_STRING_LENGTH);
GetTimeFormat(locale, 0, &systime, NULL, timebuf, MAX_STRING_LENGTH);
*buf = '\0';
_tcsncat_s(buf, buflen, datebuf, MAX_STRING_LENGTH-1);
_tcsncat_s(buf, buflen, _T(" "), MAX_STRING_LENGTH-1);
_tcsncat_s(buf, buflen, timebuf, MAX_STRING_LENGTH-1);
}
}
示例9: double_to_string
HRESULT double_to_string(double n, jsstr_t **str)
{
const WCHAR InfinityW[] = {'-','I','n','f','i','n','i','t','y',0};
if(isnan(n)) {
*str = jsstr_nan();
}else if(isinf(n)) {
*str = jsstr_alloc(n<0 ? InfinityW : InfinityW+1);
}else if(is_int32(n)) {
*str = int_to_string(n);
}else {
VARIANT strv, v;
HRESULT hres;
/* FIXME: Don't use VariantChangeTypeEx */
V_VT(&v) = VT_R8;
V_R8(&v) = n;
V_VT(&strv) = VT_EMPTY;
hres = VariantChangeTypeEx(&strv, &v, MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),SORT_DEFAULT), 0, VT_BSTR);
if(FAILED(hres))
return hres;
*str = jsstr_alloc(V_BSTR(&strv));
SysFreeString(V_BSTR(&strv));
}
return *str ? S_OK : E_OUTOFMEMORY;
}
示例10: GetTimeFormat
/*------------------------------------------------
GetTimeFormat() for 95/NT
--------------------------------------------------*/
int MyGetTimeFormatW(int ilang, int codepage,
DWORD dwFlags, CONST SYSTEMTIME *t,
wchar_t* fmt, wchar_t* dst, int n)
{
int r;
LCID Locale;
*dst = 0;
Locale = MAKELCID((WORD)ilang, SORT_DEFAULT);
if(GetVersion() & 0x80000000) // 95
{
char buf[80], afmt[40];
if(fmt)
WideCharToMultiByte(codepage, 0, fmt, -1,
afmt, 39, NULL, NULL);
r = GetTimeFormatA(Locale, dwFlags, t, fmt ? afmt : NULL, buf, 79);
if(r)
r = MultiByteToWideChar(codepage, 0, buf, -1, dst, n);
}
else // NT
{
r = GetTimeFormatW(Locale, dwFlags, t, fmt, dst, n);
}
return r;
}
示例11: LocalesEnumProc
static BOOL CALLBACK
LocalesEnumProc(LPTSTR lpLocale)
{
LCID lcid;
WCHAR lang[255];
INT index;
BOOL bNoShow = FALSE;
lcid = wcstoul(lpLocale, NULL, 16);
/* Display only languages with installed support */
if (!IsValidLocale(lcid, LCID_INSTALLED))
return TRUE;
if (lcid == MAKELCID(MAKELANGID(LANG_SPANISH, SUBLANG_SPANISH), SORT_DEFAULT) ||
lcid == MAKELCID(MAKELANGID(LANG_SPANISH, SUBLANG_SPANISH_MODERN), SORT_DEFAULT))
{
if (bSpain == FALSE)
{
LoadStringW(hInstance, IDS_SPAIN, lang, 255);
bSpain = TRUE;
}
else
{
bNoShow = TRUE;
}
}
else
{
GetLocaleInfoW(lcid, LOCALE_SLANGUAGE, lang, sizeof(lang)/sizeof(WCHAR));
}
if (bNoShow == FALSE)
{
index = SendMessageW(hList,
CB_ADDSTRING,
0,
(LPARAM)lang);
SendMessageW(hList,
CB_SETITEMDATA,
index,
(LPARAM)lcid);
}
return TRUE;
}
示例12: win32locale_test
void
win32locale_test(void)
{
nsresult result;
nsIWin32Locale* win32Locale;
nsAutoString locale;
LCID loc_id;
//
// test with a simple locale
//
locale.AssignLiteral("en-US");
loc_id = 0;
result = CallCreateInstance(kWin32LocaleFactoryCID, &win32Locale);
NS_ASSERTION(win32Locale!=NULL,"nsLocaleTest: factory_create_interface failed.");
NS_ASSERTION(NS_SUCCEEDED(result),"nsLocaleTest: factory_create_interface failed");
result = win32Locale->GetPlatformLocale(locale,&loc_id);
NS_ASSERTION(NS_SUCCEEDED(result),"nsLocaleTest: GetPlatformLocale failed.");
NS_ASSERTION(loc_id==MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),SORT_DEFAULT),
"nsLocaleTest: GetPlatformLocale failed.");
//
// test with a not so simple locale
//
locale.AssignLiteral("x-netscape");
loc_id = 0;
result = win32Locale->GetPlatformLocale(locale,&loc_id);
NS_ASSERTION(NS_SUCCEEDED(result),"nsLocaleTest: GetPlatformLocale failed.");
NS_ASSERTION(loc_id==MAKELCID(MAKELANGID(USER_DEFINED_PRIMARYLANG,USER_DEFINED_SUBLANGUAGE),SORT_DEFAULT),
"nsLocaleTest: GetPlatformLocale failed.");
locale.AssignLiteral("en");
loc_id = 0;
result = win32Locale->GetPlatformLocale(locale,&loc_id);
NS_ASSERTION(NS_SUCCEEDED(result),"nsLocaleTest: GetPlatformLocale failed.");
NS_ASSERTION(loc_id==MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_DEFAULT),SORT_DEFAULT),
"nsLocaleTest: GetPlatformLocale failed.");
win32Locale->Release();
}
示例13: _tmain
int __cdecl _tmain(int argc, TCHAR** argv)
{
int nErrors;
//init the static g_szModuleName:
if(GetModuleFileName(NULL, g_szModuleName, FC_ARRAY_LEN(g_szModuleName))==0)
{
FC_ASSERT_LASTERR(_T("GetModuleFileName"));
return 1;
}
//do some core init:
InitModuleCheckMemory(MODULE_NAME);
if(FAILED(CoInitialize(NULL)))
{
_tprintf(CG_FATAL_MSGFMT,__FILE__,__LINE__,_T("CoInitialize failed"));
nErrors = 1;
goto Ende;
}
//always remove the module name.
argv++;
argc--;
//get internal debug switches:
if(argc>0 && !lstrcmpi(_T("-!bug"), argv[0]))
{
argv++;argc--;
if(argc>0 && !lstrcmpi(_T("heap"), argv[0]))
{
argv++;argc--;
if(argc>0)
{
FC_SetAllocBreak(_tcstoul(argv[0], NULL, 10));
argv++;argc--;
}
}
}
//TODO get from registry
if(!SetThreadLocale(MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),SORT_DEFAULT)))
{
FC_ASSERT_LASTERR("SetThreadLocale()");
//don't care any more...
}
//enter main backend routine:
nErrors = CGPCmain(argc, argv);
CoUninitialize();
Ende:
ExitModuleCheckMemory(MODULE_NAME);
return nErrors?1:0;
}
示例14: GetUserDefaultUILanguage
const char * Application::getCurrentLanguageCode()
{
LANGID lid = GetUserDefaultUILanguage();
const LCID locale_id = MAKELCID(lid, SORT_DEFAULT);
static char code[3] = { 0 };
GetLocaleInfoA(locale_id, LOCALE_SISO639LANGNAME, code, sizeof(code));
code[2] = '\0';
return code;
}
示例15: FindLocaleDirectory
// FindLocaleDirectory: Search the provided path for one of the expected code page subdirectories
// Returns empty string on failure, or the full path to the c:\my\directory\1033\myrcfile.dll
static MyString FindLocaleDirectory(const MyString &path, const MyString &dllName)
{
// We'll be checking for 3 different locales: The user's default locale
// The user's primary language locale, and english (in that order)
const LCID lcidUser = MAKELCID(GetUserDefaultUILanguage(), SORT_DEFAULT);
LCID rglcid[3] = {lcidUser, MAKELCID(MAKELANGID(PRIMARYLANGID(lcidUser), SUBLANG_DEFAULT), SORTIDFROMLCID(lcidUser)), ENGLISH_LCID};
for (int i = 0; i < _countof(rglcid); i++)
{
LCID lcid = rglcid[i];
// Turn the LCID into a string
wchar_t wzNumBuf[12];
_itow_s(lcid, wzNumBuf, _countof(wzNumBuf), 10);
MyString localePath = MakePath(path, wzNumBuf, dllName);
// Check to see if the file exists
if (FileExists(localePath))
{
// make sure the console can support a codepage for this language.
UINT ConsoleCP = GetConsoleOutputCP();
// Dev10 #843375: For a GUI application, GetConsoleOutputCP returns 0
// If that's the case, we don't care about capabilities of the console,
// since we're not outputting to the console, anyway...
if ( ConsoleCP != 0 && lcid != ENGLISH_LCID )
{
LANGID LanguageID = MAKELANGID( lcid, SUBLANGID(lcid) );
// we know the console cannot support arabic or hebrew (right to left scripts?)
if( PRIMARYLANGID(LanguageID) == LANG_ARABIC || PRIMARYLANGID(LanguageID) == LANG_HEBREW )
continue;
UINT LangOEMCodepage = GetCodePage(LanguageID, LOCALE_IDEFAULTCODEPAGE);
UINT LangANSICodepage = GetCodePage(LanguageID, LOCALE_IDEFAULTANSICODEPAGE);
// We can only support it if the console's code page is UTF8, OEM, or ANSI
if( ConsoleCP != CP_UTF8 && ConsoleCP != LangOEMCodepage && ConsoleCP != LangANSICodepage )
continue;
}
return localePath;
}
}
return W("");
}