AFX_MANAGE_STATE(AfxGetStaticModuleState()); in dlls

D

david

Hi,
I made a DLL using shared MFC DLL with vs 2003 : we can call this dll
vs03.dll. So It's based on a CWinApp class. It exports function in C : we
can only focus on a function that we call fnvs03(). Normally, we must write
AFX_MANAGE_STATE(AfxGetStaticModuleState()); at the begining of this
function.
this function fnvs03() calls an object in another dll using shared MFC, but
this was made in vs 6 So there isn't CWinApp but a dllMAin (but now the
project is imported in vs2003 and compliled in it). we call this dll vs6.dll
and its object obj Objvs6.

HRESULT fnvs03(HWND hParentWindow)

{

//AFX_MANAGE_STATE(AfxGetStaticModuleState());

if(!hAdminSession)

Objvs6 obj;

return obj.function(hParentWindow);

}

obj.function(..) should launch a MFC dialog box.

Finally I made an application using shared MFC DLL in wich I load vs03.dll
and I call fnvs03(..)

If I write AFX_MANAGE_STATE(AfxGetStaticModuleState()); in fnvs03(..), the
dialog box in obj.function(..) doesn't launch.
If I don't write this the dialog box launch.
So I don't understand why it is written in all MSDN documentations that we
must write AFX_MANAGE_STATE(AfxGetStaticModuleState()); at the begining of
the C exported functions to good run and in my project, it's the opposite!!!

thanks for your help
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top