Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use capSetCallbackOnFrame ( vfw ) with MFC ??

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hy everybody,

I'm trying to use a video for windows callback funktion wich is called
capSetCallbackOnFrame in a MFC program.
Trying to use this macro is easy: capSetCallbackOnFrame ( hWnd, mycallback ).
But it's much more difficult for me to create the function mycallback!!
I tried to create a member function of the view class, because vfw becomes initiated in this
class, LPRESULT PASCAL mycallback ( ... but it didn't work.
I'm a beginner and all I did was blind trying, so can everybody tell me, how it works and
explain me why it works this way ??

Hope you'r able to help me, I'm becoming mad of this !!
Help,
SAM
 
You know... i never messed with video in c++... but all the information you need is in the MSDN!!! look what i found:

//
// FrameCallbackProc: Frame Callback Function
// Called whenever a new frame is captured but not streaming
// LRESULT FNWCALLBACK FrameCallbackProc(HWND hWnd, LPVIDEOHDR lpVHdr) {
////////////////////////////////////////////////////////////////////////
// hWnd: Application main window handle
// lpVHdr: long pointer to VideoHdr struct containing captured
// frame information
////////////////////////////////////////////////////////////////////////

return (LRESULT) TRUE ;
}


and i got from the MSDN two whole sources about those function, i'll send it to your email if you post it here

Bye,
Daniel Cohen Gindi
dcgsmix@gmx.net
 
Hi Daniel,

first of all, many thanks for your help !
I've found some hints in the MSDN ( my version is from April 2001 ), but I was not able to integrate them into my program.
I think that I misunderstood some things, cause I never worked before with callback functions.
In my kind of thinking, I've got to call the macro capSetCallbackOnFrame ... for getting a function to handle with the
captured frame.
But whenever I define a member funktion in my view class and pass the name of this funktion to the macro, I get a compiler error, cause the types are different and cannot become casted.
It seems as if this function needs a pointer of the type void*. ( My main problem, I'm not a crack on pointers )
By working with the WINAPI it is no problem, I just could copy parts of the MSDN, but I'm working with MFC and I would like to understand what I'm doing.
Would be nice if you could help me !
I'm sorry, at the moment I've got no private e-mail adress, because my last provider stopped his business in germany, I tried a new one, but he's very slow and they didn't pass a new adress til today !
( Think I've got to look for a third one )
Could you post here the headlines of the articles I should find them in the MSDN.

Thanx,
Peter
 
1st, i'm talking about the offline MSDN that comes with VC++ 6.0

And you just need to pass the name of the callback function to your capSetCallbackOnFrame as a parameter.

Lets say that your function name is FrameCallbackProc:
LRESULT FNWCALLBACK FrameCallbackProc(HWND hWnd, LPVIDEOHDR lpVHdr)
and your hwnd is ghWndCap, use it like this:

capSetCallbackOnFrame(ghWndCap, FrameCallbackProc)

If you still need help, post here or in my email

Daniel Cohen Gindi
dcgsmix@gmx.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top