Containers, documents, views and asserts
From: Murrgon (murrgon_at_hotmail.com)
Date: 11/24/04
- Next message: Tom Serface: "Re: MDI App Frame"
- Previous message: venAdder: "how to start Sql Server Agent from VC++?"
- Next in thread: Murrgon: "Re: Containers, documents, views and asserts"
- Maybe reply: Murrgon: "Re: Containers, documents, views and asserts"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 24 Nov 2004 16:47:29 -0500
This is going to be a long explanation, so bare with me please.
I have a basic application using Win32 that I am using to render
various media files (images such as bmp, jpg, tga, etc) using
DirectX. This application has a plugin architecture I have set
up so I can add support for other media types by adding more
dlls. Each plugin dll can add support for one or more media
types.
Recently I have attempted to add support for rendering flash files
to my application (.swf files). I had previously written a test
app using an SDI MFC setup. This prototype stole a lot of code
from the test ActiveX container so I could get access to the OLE
items of the document that represents the Flash document and draw
it independent of the window. This is key because I am rendering
the Flash content to DC I obtained from a DirectX surface.
What have attempted to do in my main application is take the Flash
prototype that I built and dump it into a DLL. I also switched
from SDI to MDI because there are times when I will want to have
two flash files open at the same time. My main application starts
up and the flash player dll is loaded with no problems. I am just
hiding the window(s) created by the flash player dll as I don't
need them, only access to the contents of the document.
I have a call originating in the main application that goes to the
flash player dll telling it to load a particular .swf file. The
loading completes okay, but the program ASSERTs in a call to
CWnd::AssertValid() for my view class. The specific assert is
on the statements:
CHandleMap* pMap = afxMapHWND();
ASSERT(pMap != NULL);
The comments a bit lower say that the assert is caused by using
CWnd objects across thread boundaries. This is where things start
to get messy.
My application told the dll to open the .swf file so the document,
its view and its frame are created in that thread. But the CWinApp
derived class I have in the flash player dll will have created its
own thread and this is where everything starts to fall apart. As
soon as the thread in the flash dll starts to dispatch messages
it generates the assert. Not to mention that there is the whole
ActiveX flash control as well that has its own thread and hooks to
the View window of the document.
I realized, even before I started, that the Flash player in a dll
using MFC was really messy. Unfortunately the ATL knowledge to
do the same thing without using MFC I do not possess and this is
not some simple little task that I can find some sample code for
somewhere on the net.
So, it boils down to this: can someone make a suggestion on how
to make my MFC dll work properly? Failing that, I will take
suggestions on how I might go about doing this with ATL or some
other method.
Thanks a tonne
Murrgon
- Next message: Tom Serface: "Re: MDI App Frame"
- Previous message: venAdder: "how to start Sql Server Agent from VC++?"
- Next in thread: Murrgon: "Re: Containers, documents, views and asserts"
- Maybe reply: Murrgon: "Re: Containers, documents, views and asserts"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|