Click to See Complete Forum and Search --> : Locale Problem


Sreenivasarao Kosuru
March 31st, 1999, 05:54 AM
VC++ 6.0 MFC, Win98 and WinNT(Japanese Version)

Hi devs,

My application is taking resources from a DLL, (which is

resource only DLL). Before loading the DLL I am checking whether the DLL exists in the directory or not.

The dll name is the localename + .DLL ( in this case c.dll)

While making the DLL i am giving the locale name.dll in the project ->settings so that the output file is

localename.dll

I am also printing the current locale information in the about dialog box.

When i run the application, and see the about box, it shows "c" as its locale. But when i run the same application on

Japanese winNT, it is

also showing "C".

The problem is i am not able to figure out

a) whether the locale on Japanese NT is "C" or not

b) If it is " C" why it is not reading resources from c.dll, when run on

Japanese version.

On English Version Everything is working fine.

The code is as follows.

BOOL CMyApp::InitInstance()

{

CString BuildDir = "\\WinDebug\\";

CString DllDir = szCurDir + BuildDir;

CString Localeinfo = DllDir + CString(setlocale(LC_ALL, NULL)) + ".DLL";

if ( Localeinfo)

{

if ((m_hInstDLL = LoadLibrary(Localeinfo)) == NULL)

{

NestEvalMsgBox(ID_LOCALIZED_RES_FAILED);

IsDllLoaded = FALSE;

//return FALSE; // Failed to load the localized resources.

}

else

{

AfxSetResourceHandle(m_hInstDLL);

IsDllLoaded = TRUE;

// Get resources from the DLL.

}

}

}

For the About box dialog

BOOL CAboutDlg::OnInitDialog()

{

CDialog::OnInitDialog();

// TODO: Add extra initialization here

CString LocaleInfo = setlocale(LC_ALL, NULL);

SetDlgItemText(IDC_ABOUT_LOCALE, (LPCTSTR)LocaleInfo);

return TRUE; // return TRUE unless you set the focus to a control

// EXCEPTION: OCX Property Pages should return FALSE

}



Thanks.


with best wishes,

Sreenivas.