Shell extension using MFC extension DLLs 
Author Message
 Shell extension using MFC extension DLLs

I have a working shell extension written as a USERDLL using staticaly
linked MFC.  I did it in the MFC 3.x days, and I am trying to change it to
Regular DLL that uses MFC in shared DLL and my own MFC extension DLLs.

In my shell extension's IShellPropSheetExt OLE interface I have the
following code for adding pages.  Shell Extension class is derived from

lpfnAddPage, LPARAM lParam)
 METHOD_PROLOGUE(CArcSessShellExt, SessShellExt);
CMyObject* pObj = NULL;

CFile theFile( pThis->m_szFileName, CFile::modeRead);
CArchive theArch(&theFile, CArchive::load);
theArch >> pObj;

CMyObject is a class exported with AFX_EXT_CLASS from my MFC extension

The code above creates a correct file and archive but throws badClass
archive exception when trying to load CMyObject.  It calls CArchive::ReadCla
ss() and CRuntimeClass::Load(CArchive& ar, UINT* pwSchemaNum) in MFC, where
it reads the class name correctly.  However, CRuntimeClass::Load() fails to
find it in the module state class lists, including lists for shared DLLs
(it actually finds only few collection classes in those lists).  

I thought that METHOD_PROLOGUE and my classes defined with AFX_EXT_CLASS
should be enough to manage module states. Does anyone know what is wrong
here??? Thanks!

Operator >> is hidden in MFC DECLARE/IMPLEMENT_SERIAL macros, and is not
exported (I exported it in .def file).  I tryed to wrap it in my global
friend function LoadObject( CArchive&, CMyObject&* ), exported with
__declspec( dllexport ).  When I added AFX_MANAGE_STATE( AfxGetStaticModuleS
tate() ) at the beginning of the function, it did not link complaining


Mon, 15 Nov 1999 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. How to export a class from Extension MFC dll to another Extension MFC dll

2. a MFC extension DLL in another MFC extension DLL

3. LNK2001 when trying to link a MFC Extension DLL into another Extension DLL

4. Can I write Shell Extension Dll by MFC?

5. Using an MFC Extension DLL from an MFC ActiveX Control

6. Making MFC extension dll using static MFC library

7. Using resource DLLs with MFC extension DLLs

8. loading an MFC DLL that was originally an extension dll from a non MFC dLL

9. Access Violation when ADO is used from global object exported from MFC extensions DLL (VC++)

10. Using ATL in MFC extension DLLs

11. using MFC Extension DLL from ATL server(exe)

12. Using a virtual function in MFC Extension DLL


Powered by phpBB® Forum Software