Friends, I have a program X that was developed in MFC and uses the Doc/View architecture. Since MFC provides elegant support for features like printing and print preview, implementing these features have been a breeze. Now a major change to the program design is being made. There is a third party application Z to which we do not have the source code. The third party supports the concept of plugins ( using a propreitary plugin specification). The application X mentioned above now needs to go and has to be reimplemented as a plugin DLL for Z. The plugin needs to export some functions with which it can talk to the host. The host application provides the necessary API to create menus, toolbars etc for the plugin. I want to reuse as much of the original application X as possible. I still want the print and print preview routines to reuse the same code using the MFC Doc/View architecture. The host may or maynot be an MFC application and in any case no source is available. Is there a systematic way to convert the exe program into a plugin DLL? Would creating a CWinApp class in the DLL and moving all the code into the DLL do the trick? Eg, I have the following piece of code in the CWinApp::InitInstance methd of program X CMultiDocTemplate* pDocTemplate; pDocTemplate = new CMultiDocTemplate( IDR_ANALTYPE, RUNTIME_CLASS(CAnalyzerDoc), RUNTIME_CLASS(CChildFrame), // custom MDI child frame RUNTIME_CLASS(CAnalyzerView)); AddDocTemplate(pDocTemplate); pDocTemplate = new CMultiDocTemplate( IDR_ANALTYPE, RUNTIME_CLASS(CAnalyzerDoc), RUNTIME_CLASS(CPrintFrame), // custom MDI child frame RUNTIME_CLASS(CPrintView)); AddPrintHelperTemplate(pDocTemplate); // create main MDI Frame window CMainFrame* pMainFrame = new CMainFrame; if (!pMainFrame->LoadFrame(IDR_MAINFRAME)) return FALSE; m_pMainWnd = pMainFrame; Are these code portable to the WinApp implementation of the plugin DLL too? Any suggestions or ideas are welcome. Regards, Ram