From: Martin on
Hi.

Please, help me find out what's happenning with
'CPropertySheet::OnInitDialog()' after AfxSetResourceHandle() is
called.

I'm working at a multilingual application. The user can change it's UI
language from the 'Settings' property sheet. When user does it, the
program loads the appropriate resource DLL and calls
'AfxSetResourceHandle()' to set the new source for resources. And when
the user wants to open the 'Settings' property sheet the second time,
a memory access violation arises and the sheet doesn't even appear.
BTW, other dialogs (non property sheet) successfully open. I've
debugged through the code of my property sheet, and saw the exception
arises in the following function from "afxstate.cpp", on the very
first statement:

AFX_MODULE_THREAD_STATE* AFXAPI AfxGetModuleThreadState()
{
AFX_MODULE_THREAD_STATE* pResult=AfxGetModuleState()-
>m_thread.GetData();
ENSURE(pResult != NULL);
return pResult;
}

I've found some similar articles, but none of them answers my
question: is there any problems with using CPropertySheet after
AfxSetResourceHandle() is called?

Thanks in advance,
Martin

From: David Lowndes on
>I'm working at a multilingual application. The user can change it's UI
>language from the 'Settings' property sheet. When user does it, the
>program loads the appropriate resource DLL and calls
>'AfxSetResourceHandle()' to set the new source for resources. And when
>the user wants to open the 'Settings' property sheet the second time,

Martin,

Does it work at all once you've called AfxSetResourceHandle to alter
the language DLL?

>a memory access violation arises and the sheet doesn't even appear.
>BTW, other dialogs (non property sheet) successfully open. I've
>debugged through the code of my property sheet, and saw the exception
>arises in the following function from "afxstate.cpp", on the very
>first statement:
>
>AFX_MODULE_THREAD_STATE* AFXAPI AfxGetModuleThreadState()
>{
> AFX_MODULE_THREAD_STATE* pResult=AfxGetModuleState()-
>>m_thread.GetData();

If it's there, it doesn't to my mind have anything directly to do with
changing the resource. Is the crash actually there, or inside
AfxGetModuleState or GetData?

Are you 100% sure you have a copy of *all* the resources your
application needs in the translated DLL?

Dave