Containers, documents, views and asserts

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Murrgon (murrgon_at_hotmail.com)
Date: 11/24/04


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



Relevant Pages

  • HELP !!! Capturing "linked videos" from Flash - Im Stumped
    ... I have a couple of Flash ... capture utilities -and they work fine for games, animations, etc. ... I am talking about a tiny swf file that "references" a video clip ... Real Video - I use notepad to look in the "ram" file to find the ...
    (rec.video.desktop)
  • IE 6 image render bug w/javascript inserted flash object
    ... I'm experiencing a weird rendering bug in IE 6. ... For instance I have a flash banner/navigation on the site. ... contains 30 or so thumbnail images, it pulls the flash file from cache ... on a page displaying an image of a map. ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Re: ripping webarchives with historic or art photos
    ... have on display (without a flash though). ... wouldn't have any rights to sell it. ... only person you could sell it to would be another idiot like yourself. ... They take apart the data in an SWF file and save it as their original ...
    (rec.photo.digital)
  • Re: Slide Show
    ... The above FREE program will convert videos to flash and provide the ... Publish to the web and post the SWF file in the same folder ... Publisher and now uploaded) such that c 10/12 photos are shown as a slide ...
    (microsoft.public.publisher.webdesign)
  • Re: how to add flash animation into frontpage 2003
    ... > HI Kevin Spencer ... > have the flash player downloaded now and i was wondering how can i ... > wordart in frontpage 2003 into a swf file and with the swf file can i get ... >> can certainluy use FrontPage to embed a .swf into a web page. ...
    (microsoft.public.frontpage.programming)