Development/Visual C++
[C++/MFC] 시스템 설정 언어 정보 가져오기 GetLocaleInfo
qWooWp
2023. 4. 7. 10:19
반응형
아래와 같이 가져올 수 있음.
리턴되는 값은 문자열로 처리를 원할하게 하기 위해 숫자로 변환할 필요가 있다.
#include <windows.h>
#include <WinNls.h>
int getUserLocale()
{
char str_result[255];
int iRet = GetLocaleInfoEx(LOCALE_NAME_USER_DEFAULT,
LOCALE_ILANGUAGE,
(LPWSTR)str_result,
sizeof(str_result)
);
if (iRet == 0)
{
printf(" error code = %d", GetLastError());
}
//[todo] need to change to result from str_result
return result;
}
또는 더 쉬운 방법 (아래처럼 한줄로~ 이게 더 쉽다... ) ㅠ.ㅠ;
langid = PRIMARYLANGID(GetUserDefaultLangID());
참고 정보
https://learn.microsoft.com/en-us/windows/win32/api/winnls/nf-winnls-getlocaleinfoex
https://learn.microsoft.com/en-us/windows/win32/intl/locale-ilanguage
반응형