I need an API to copy the contents of a selected portion of the screen (the contexts of my webcam window) into a buffer, a bitmap image or anything in which I can access the raw data from the screen.

I can find the window handle alright and create a DC and a bitmap object, but what API can I use to snap the window contents ?

Thanks for your help,
Posted on 2003-07-01 14:39:39 by Binary construct
bitblt or copyrect ? or something =) ?
Posted on 2003-07-01 16:35:48 by SFP
Afternoon, Binary construct.

Using the boards' search feature for "webcam" came up with this thread:

Download the proggy and have a look at its code. Part of it does *exactly* what you're wanting to do.

Posted on 2003-07-01 19:07:02 by Scronty
Thanks Scronty,
That's just what I was looking for, much better than grabbing it off the screen. However, the code doesn't seem to assembly, its missing a file Vfw.inc

I've looked in masm's include directory and there's a Vfw32.inc file, but this causes lots of assembly errors. Other people seem to have got this working ok. Am I using an out of date version of masm (6.14.8444) or is Vfw.inc a non-standard file?

Posted on 2003-07-02 13:21:31 by Binary construct
Afternoon, Binary construct.

Attached is the vfw.inc file I use.

The vfw32.inc file which comes with the Masm32 package only has the prototypes for Vfw32.lib. It doesn't include the required EQUates and structures.

Posted on 2003-07-02 17:02:21 by Scronty
Ahh that fixed it, thanks Scronty.

So the capture window that is created with the call to 'CapCreateCaptureWindow' takes care of all the low-level comms with the webcam driver ?

Where did you learn to use functions in the Vfw.inc file ? Is documentation for this publically available ?

The raw bitmap created in the prSaveImage function is just what i'm looking for. I plan on using it to write a motion-detection algorithm, then later move onto facial recognition (although I'll have to use C++ here).

Thanks again,
Posted on 2003-07-05 15:37:06 by Binary construct