Invalid Module state in unmanaged DLL
-
I have VC6 DLL which calls AfxGetApp to get the default printer and creates CWnd dynamicly I have recompiled this DLL in .NET and call the DLL from an assemible. When I step into the code the AfxGetApp now returns NULL. So I can nolonger get the default printer. When I call Create on a CWnd. .Net throws an excemption, I trace the excemption to winCore.cpp line 678 cs.hInstance = AfxGetInstanceHandle(); the assertion is due to afxCurrentInstanceHandle == NULL Is there a work around to enable the unmanaged DLL to assign a valid afxCurrentInstanceHandle and return a valid pointer to a Cwinapp
-
I have VC6 DLL which calls AfxGetApp to get the default printer and creates CWnd dynamicly I have recompiled this DLL in .NET and call the DLL from an assemible. When I step into the code the AfxGetApp now returns NULL. So I can nolonger get the default printer. When I call Create on a CWnd. .Net throws an excemption, I trace the excemption to winCore.cpp line 678 cs.hInstance = AfxGetInstanceHandle(); the assertion is due to afxCurrentInstanceHandle == NULL Is there a work around to enable the unmanaged DLL to assign a valid afxCurrentInstanceHandle and return a valid pointer to a Cwinapp
The Afx* calls require that MFC be initialized. If you are calling this DLL from a managed program (non-MFC) you'd prolly have to initialize MFC yourself. Regards, Nish
Author of the romantic comedy Summer Love and Some more Cricket [New Win] Review by Shog9 Click here for review[NW]
-
The Afx* calls require that MFC be initialized. If you are calling this DLL from a managed program (non-MFC) you'd prolly have to initialize MFC yourself. Regards, Nish
Author of the romantic comedy Summer Love and Some more Cricket [New Win] Review by Shog9 Click here for review[NW]
plz tell how to initialized MFC? i need complete syntex . if you could tell the link related code i will be very thank to u. and one thing more if that initialized code is in dll or not in dll. how to deal with it ? r00d0034@yahoo.com