Professional UI Solutions
Site Map   /  Register


Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » Crash after AfxSetResourceHandle() Collapse All
Subject Author Date
T P Jan 30, 2008 - 3:34 AM


we’re trying to load a localized dll into our dialog based application.
We use the following class inside the InitInstance function of our App code to load the language dll:

    nLanguage = GetLanguage();    
    GetProgDir( szPath );
    switch ( nLanguage ) {
    case LANG_DEU :
        strcat( szPath, "bin32\\XXGer.dll" );
        m_hInst = LoadLibrary( szPath );
        if ( m_hInst != NULL )
            AfxSetResourceHandle( m_hInst );
    case LANG_OTH :
        strcat( szPath, "bin32\\Locale\\XXCustom.dll" );
        m_hInst = LoadLibrary( szPath );
        if ( m_hInst != NULL )
            AfxSetResourceHandle( m_hInst );

When we try to open the modal dialog the function immediately returns -1:

    XXDlg dlg;
    m_pMainWnd = &dlg;
    int nResponse = dlg.DoModal();
    if (nResponse == IDOK) {
        // Dialog wurde mit OK beendet.
    } else if (nResponse == IDCANCEL) {
        // Dialog wurde mit CANCEL beendet.

If AfxSetResource handle is not used the dialog opens normal.
We don’t want to use g_ResourceManager because it doesn’t work for us. We use Prof-UIS Version 2.62

thanks in advance


Technical Support Jan 31, 2008 - 12:09 PM

Unfortunately we do not support old versions including v.2.62. The localization support was considerably improved so there is a big difference between 2.82 and 2.62 in this regard. Do you have any reason not to switch to the latest 2.82?