I am loading multiple language resources and the strings load properly. I am having a problem getting the dialog identifiers. Here is the code:
Code:
LPCTSTR get_dialog(int nResID)
{
LPCTSTR ptcBlock;
HGLOBAL hg;
HRSRC hResourceInfoBlock;
LPCTSTR szTemplate = MAKEINTRESOURCE(nResID);
if( // use methods until we find one that works
(NULL != (hResourceInfoBlock = FindResourceEx( hInstGlobal, RT_DIALOG, szTemplate, GetUserDefaultLangID()))) ||
(NULL != (hResourceInfoBlock = FindResourceEx( hInstGlobal, RT_DIALOG, szTemplate, GetSystemDefaultLangID()))) ||
(NULL != (hResourceInfoBlock = FindResourceEx( hInstGlobal, RT_DIALOG, szTemplate, MAKELANGID( LANG_ENGLISH, SUBLANG_ENGLISH_US ))))
)
{
;
}
//
if( hResourceInfoBlock )
{
if(
(NULL != (hg = LoadResource( hInstGlobal, hResourceInfoBlock ))) &&
(NULL != (ptcBlock = (char*)LockResource(hg))) )
{
return ptcBlock;
}
}
return 0;
}
The result should be fed into CreateDialogParam as a dialog ID
Code:
lpDialog = get_dialog(MAKEINTRESOURCE(IDD_MAIN));
hDlg = CreateDialogParam(hInstance, lpDialog,
hWndParent, (DLGPROC)DlgProc, (LPARAM)this);
Please take a look and see what am I doing wrong.
Thanks
Code:
LPCTSTR get_dialog(int nResID)
{
LPCTSTR ptcBlock;
HGLOBAL hg;
HRSRC hResourceInfoBlock;
LPCTSTR szTemplate = MAKEINTRESOURCE(nResID);
if( // use methods until we find one that works
(NULL != (hResourceInfoBlock = FindResourceEx( hInstGlobal, RT_DIALOG, szTemplate, GetUserDefaultLangID()))) ||
(NULL != (hResourceInfoBlock = FindResourceEx( hInstGlobal, RT_DIALOG, szTemplate, GetSystemDefaultLangID()))) ||
(NULL != (hResourceInfoBlock = FindResourceEx( hInstGlobal, RT_DIALOG, szTemplate, MAKELANGID( LANG_ENGLISH, SUBLANG_ENGLISH_US ))))
)
{
;
}
//
if( hResourceInfoBlock )
{
if(
(NULL != (hg = LoadResource( hInstGlobal, hResourceInfoBlock ))) &&
(NULL != (ptcBlock = (char*)LockResource(hg))) )
{
return ptcBlock;
}
}
return 0;
}
The result should be fed into CreateDialogParam as a dialog ID
Code:
lpDialog = get_dialog(MAKEINTRESOURCE(IDD_MAIN));
hDlg = CreateDialogParam(hInstance, lpDialog,
hWndParent, (DLGPROC)DlgProc, (LPARAM)this);
Please take a look and see what am I doing wrong.
Thanks