Windows API Webcam Snap

Hello everyone,

ive just wondered how i can take a snapshot of my webcam after listing all available sources. So I searched for this topic, but did not really find it.

Can someone give me any advice how to do that, maybe by an conde example?

By the way:
I want to be able to access this image via char * and any FileSize variable.

nice greetings

Luke
Ive just found something:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
 // create the preview window
    HWND hCam = capCreateCaptureWindow(
            "hoven",
            WS_CHILD,
            0, 0, 0, 0,
            ::GetDesktopWindow(), 0);

    // connect to the first camera
    // for other cameras try index
    // 1, 2, in place of the 0 below
    if(capDriverConnect(hCam, 0))
    {

        capFileSaveDIB(hCam, "shot.bmp");

        // the screenshot is in the current
        // directory, usually the same
        // where the exe is created by
        // your compiler
        printf("Saved as shot.bmp!");

    }

    else
    {

        printf("Check camera?");

    }


The problem is, that i want to get this image as char * and not save it into a file and i didnt find anything according to that topic...
Last edited on
Topic archived. No new replies allowed.