null frames

symfonysid
Posts: 20
Joined: Fri Nov 09, 2007 7:39 am

Re: null frames

Post by symfonysid »

Hi,

I've been reading through the C++ VC8/2005 sample trying to figure out how to set-up a callback. But I don't understand how this sample works. So, I was hoping that someone could give me a little help with it.

What I've seen so far is that:

The class CCameraEvents in CameraDlg.h registers the callback method HandleFrameAvailable().

The class CCameraDlg which actually contains the callback subclasses CCameraEvents().

The method OnInitDialog() in the class CCameraDlg contains the line of code:
// hook up connection points
this->DispEventAdvise(m_spCamera);
I think this is what sets up the callback, but whenever I try to make this same call myself, I get exception, because somewhere, MFC is trying to make a lock, but it can't do so. I'm not sure what state the pointer m_spCamera is actually in when this method is called. Has it been initialized? Has the camera been opened? I don't know...

In any case I've adapted this code as best I could for my own application, but the callback isn't actually used. And my guess at the moment is that it's because my call to DispEventAdvise() is failing. However, maybe I misunderstood the significance of this method, and there is something else that is happening in the sample application which I'm not doing.

Thank you for your help.

Greg
Post Reply