Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Capture an image from a webcam !

$
0
0
hallo everybody :)


Is there another way :(

[ autoit ]         
SNAPWEBCAM(@ScriptDir & "\WBshot.bmp") Func SNAPWEBCAM($snapfile) Local Const $WS_CHILD = 0x40000000 Local Const $WM_CAP_START = 0x400 Local $WM_CAP_FILE_SAVEDIBA = $WM_CAP_START + 25 Local $WM_CAP_GRAB_FRAME_NOSTOP = $WM_CAP_START + 61 Local $WM_CAP_DRIVER_DISCONNECT = $WM_CAP_START + 11 Local $WM_CAP_DRIVER_CONNECT = $WM_CAP_START + 10 Local $WM_CAP_SET_SCALE = $WM_CAP_START + 53 Local $WM_CAP_SET_OVERLAY = $WM_CAP_START + 51 Local $WM_CAP_SET_PREVIEWRATE = $WM_CAP_START + 52 Local $WM_CAP_SET_PREVIEW = $WM_CAP_START + 50 Local $WM_CAP_UNICODE_START = $WM_CAP_START + 100 Local $avi = DllOpen("avicap32.dll") Local $user = DllOpen("user32.dll") Local $cap = DllCall($avi, "int", "capCreateCaptureWindow", "str", "cap", "int", $WS_CHILD, "int", 15, "int", 15, "int", 320, "int", 240, "hwnd", GUICreate("", 0, 0), "int", 1) DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_DRIVER_CONNECT, "int", 0, "int", 0) DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_SET_SCALE, "int", 1, "int", 0) DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_SET_OVERLAY, "int", 1, "int", 0) DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_SET_PREVIEW, "int", 1, "int", 0) DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_SET_PREVIEWRATE, "int", 1, "int", 0) GUISetState(@SW_DISABLE) Local $time = TimerInit() While True   FileDelete($snapfile)   DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_GRAB_FRAME_NOSTOP, "int", 0, "int", 0)   DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_FILE_SAVEDIBA, "int", 0, "str", $snapfile)   If TimerDiff($time) > 900 Then ExitLoop WEnd DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_UNICODE_START, "int", 0, "int", 0) DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_DRIVER_DISCONNECT, "int", 0, "int", 0) DllClose($avi) DllClose($user) EndFunc   ;==>SNAPWEBCAM

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>