CFrameWnd in a DLL? 
Author Message
 CFrameWnd in a DLL?

Hi group,

I need to create a CFrameWnd /CDocument/ CView in a DLL that would be called
from MFC& non-MFC apps.
I thought creating descendant classes in a regular DLL usingn MFC (extension
DLLs) would do the job.

But even the autogenerated code (VC6) for regular DLL generates assert
failure when calling AfxMessageBox() in exported function.

Can anyone tell me what is the problem and how is this done?

Thanks!



Sat, 10 Sep 2005 15:50:30 GMT  
 CFrameWnd in a DLL?


Quote:
> Hi group,

> I need to create a CFrameWnd /CDocument/ CView in a DLL that would be
called
> from MFC& non-MFC apps.
> I thought creating descendant classes in a regular DLL usingn MFC
(extension
> DLLs) would do the job.

> But even the autogenerated code (VC6) for regular DLL generates assert
> failure when calling AfxMessageBox() in exported function.

> Can anyone tell me what is the problem and how is this done?

> Thanks!


I manged to handle the problem in this way but I'm not sure it is the right
(no side effects expected)

(1) build regular DLL (with MFC support)
(2) create new MFC classes CMyFrameWnd, CMyDocument, CMyView
(3) added extern "C" int __declspec(dllexport) __stdcall TestMyFrameWnd()
(4) in exported function created CSingleDocTemplate() and called its
OpenDocumentFile();
(5) then for theApp.m_pMainWnd called  ShowWindow(), UpdateWindow(),
(6) for theApp.m_pMainWnd called  RunModalLoop() !!!

(7) on CMyFrameWnd::OnClose() called EndModalLoop()

(8) in exported function for theApp.m_pMainWnd call DestroyWindow();

Is this what is expected?

Thanks!



Sat, 10 Sep 2005 17:42:57 GMT  
 CFrameWnd in a DLL?
In a regular dll, you would need to use AFX_MANAGE_STATE macro for each
exported functions. Are you doing this?

--
Ajay Kalra [MVP - VC++]


Quote:
> Hi group,

> I need to create a CFrameWnd /CDocument/ CView in a DLL that would be
called
> from MFC& non-MFC apps.
> I thought creating descendant classes in a regular DLL usingn MFC
(extension
> DLLs) would do the job.

> But even the autogenerated code (VC6) for regular DLL generates assert
> failure when calling AfxMessageBox() in exported function.

> Can anyone tell me what is the problem and how is this done?

> Thanks!




Sat, 10 Sep 2005 19:38:57 GMT  
 CFrameWnd in a DLL?
Certainly,... it is part of the wizard autogen code!

George VS (gogovsh)


Quote:
> In a regular dll, you would need to use AFX_MANAGE_STATE macro for each
> exported functions. Are you doing this?

> --
> Ajay Kalra [MVP - VC++]



> > Hi group,

> > I need to create a CFrameWnd /CDocument/ CView in a DLL that would be
> called
> > from MFC& non-MFC apps.
> > I thought creating descendant classes in a regular DLL usingn MFC
> (extension
> > DLLs) would do the job.

> > But even the autogenerated code (VC6) for regular DLL generates assert
> > failure when calling AfxMessageBox() in exported function.

> > Can anyone tell me what is the problem and how is this done?

> > Thanks!




Sun, 11 Sep 2005 09:50:40 GMT  
 CFrameWnd in a DLL?
It should work. It could be that you need to put the app module state. Try
this:

{
     AFX_MANAGE_STATE(AfxGetAppModuleState());
    AfxMessageBox(...);

Quote:
}

--
Ajay Kalra [MVP - VC++]


Quote:
> Certainly,... it is part of the wizard autogen code!

> George VS (gogovsh)



> > In a regular dll, you would need to use AFX_MANAGE_STATE macro for each
> > exported functions. Are you doing this?

> > --
> > Ajay Kalra [MVP - VC++]



> > > Hi group,

> > > I need to create a CFrameWnd /CDocument/ CView in a DLL that would be
> > called
> > > from MFC& non-MFC apps.
> > > I thought creating descendant classes in a regular DLL usingn MFC
> > (extension
> > > DLLs) would do the job.

> > > But even the autogenerated code (VC6) for regular DLL generates assert
> > > failure when calling AfxMessageBox() in exported function.

> > > Can anyone tell me what is the problem and how is this done?

> > > Thanks!




Sun, 11 Sep 2005 08:58:03 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. DLL with CFrameWnd

2. CFrameWnd in dll

3. Creating an extension DLL with a CFrameWnd derived class

4. CFrameWnd styles

5. CFrameWnd

6. Create Modal CFrameWnd ?

7. getting pointer to CFrameWnd using a HWND

8. VC++ CFrameWnd

9. CFrameWnd-like CStatic-Frame in a

10. CFrameWnd without an border

11. Height of controls on CFrameWnd

12. removing menu in CFrameWnd?

 

 
Powered by phpBB® Forum Software