#AutoIt3Wrapper_UseX64=N
Global Const $WM_CAP_START = 0x400
Global Const $WM_CAP_DRIVER_CONNECT = $WM_CAP_START + 10
Global Const $WM_CAP_DRIVER_DISCONNECT = $WM_CAP_START + 11
Global Const $WM_CAP_SET_OVERLAY = $WM_CAP_START + 51
Global Const $WM_CAP_SET_PREVIEW = $WM_CAP_START + 50
Global Const $WM_CAP_SET_PREVIEWRATE = $WM_CAP_START + 52
Global Const $WM_CAP_SET_SCALE = $WM_CAP_START + 53
Global $avi = DllOpen("avicap32.dll")
Global $user = DllOpen("user32.dll")
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$hForm = GUICreate("", 320, 240)
$Cap = DllCall($avi, "int", "capCreateCaptureWindow", "str", "cap", "int", BitOR($WS_CHILD, $WS_VISIBLE), "int", 0, "int", 0, "int", 320, "int", 240, "hwnd", $hForm, "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", 1)
DllCall($user, "int", "SendMessage", "hWnd", $Cap[0], "int", $WM_CAP_SET_OVERLAY, "int", 1, "int", 1)
DllCall($user, "int", "SendMessage", "hWnd", $Cap[0], "int", $WM_CAP_SET_PREVIEW, "int", 1, "int", 1)
DllCall($user, "int", "SendMessage", "hWnd", $Cap[0], "int", $WM_CAP_SET_PREVIEWRATE, "int", 1, "int", 1)
GUISetState()
While 1
Switch GUIGetMsg()
Case - 3
Exit
EndSwitch
WEnd