Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- #define _CRT_SECURE_NO_DEPRECATE
- #include <stdbool.h>
- #include <stdio.h>
- #include <windows.h>
- #include <vfw.h>
- bool webcam_image_simple(const char *filename)
- {
- bool rc = false;
- HWND hWnd = capCreateCaptureWindow("capture", WS_POPUP, 0, 0, 640, 480,
- NULL,.0);
- if (hWnd) {
- SendMessage(hWnd, WM_CAP_DRIVER_CONNECT, 0, 0);
- rc = (bool) SendMessage(hWnd, WM_CAP_FILE_SAVEDIB, 0, (LPARAM) filename);
- SendMessage(hWnd, WM_CAP_DRIVER_DISCONNECT, 0, 0);
- SendMessage(hWnd, WM_CLOSE, 0, 0);
- }
- return rc;
- }
- int main(void)
- {
- printf("Acquiring image: %s\n", webcam_image_simple("test.bmp") ? "suceess" : "error");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement