Code Block
HINSTANCE g_hInst;
HINSTANCE GetResHInstFormLangId(LANGID langId)
{
CString resDllName;
resDllName.Format(_T(
"res%04x.dll"), langId);
HINSTANCE hInst = LoadLibrary(resDllName);
if(!hInst)
{
LANGID priLangId = PRIMARYLANGID(langId);
resDllName.Format(_T(
"res%02x.dll"), priLangId);
hInst = LoadLibrary(resDllName);
}
return hInst;
}
BOOL ClocalizedApp::InitInstance()
{
#if
defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP)
SHInitExtraControls();
#endif
// WIN32_PLATFORM_PSPC || WIN32_PLATFORM_WFSP
SetRegistryKey(_T(
"Local AppWizard-Generated Applications"));
//Home made localization support
LANGID userLangId = GetUserDefaultUILanguage();
g_hInst = GetResHInstFormLangId(userLangId);
if(!g_hInst )
{
sysLangId = GetSystemDefaultUILanguage();
if(userL
andId != sysLangId)
g_hInst = GetResHInstFormLangId(sysLangId);
}
if(g_hInst)
AfxSetResourceHandle(g_hInst);
ClocalizedDlg dlg;
m_pMainWnd = &dlg;
INT_PTR nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
}
return FALSE;
}