#region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_UseX64=n
#endregion ;**** 参数创建于 ACNWrapper_GUI ****
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#include <Date.au3>
#region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 325)
$Pic1 = GUICtrlCreatePic("", 264, 8, 321, 233)
$List1 = GUICtrlCreateList("", 10, 8, 241, 238, 0)
$Button1 = GUICtrlCreateButton("枚举摄像头", 10, 264, 75, 25)
$Button2 = GUICtrlCreateButton("开启摄像头", 95, 264, 75, 25)
$Button3 = GUICtrlCreateButton("关闭摄像头", 180, 264, 75, 25)
$Button4 = GUICtrlCreateButton("截图", 265, 264, 75, 25)
$Button5 = GUICtrlCreateButton('开始录制', 350, 264, 75, 25)
$Button6 = GUICtrlCreateButton('停止录制', 435, 264, 75, 25)
$Button7 = GUICtrlCreateButton('生成视频', 520, 264, 75, 25)
GUICtrlCreateLabel("截图默认放在d:\1.bmp", 24, 296, 199, 17)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
$dll = DllOpen(@ScriptDir & "\VedioCapture.dll")
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$list = DllCall($dll, "str", "GetCameraList")
If $list[0] <> "" Then
$t = 0
$CameraList = StringSplit($list[0], "|")
For $s = 1 To $CameraList[0]/2
GUICtrlSetData($List1, $CameraList[$t+1] & "*" & $CameraList[$t + 2])
$t += 2
Next
EndIf
Case $Button2
$ID = StringSplit(GUICtrlRead ($List1),"*")
DllCall($dll, "int", "SetCameraID","int",$ID[1])
DllCall($dll, "int", "StartCamera","hwnd",GUICtrlGetHandle($Pic1) )
Case $Button3
$ID = StringSplit(GUICtrlRead ( $List1 ),"*")
DllCall($dll, "int", "CloseCamera","int",$ID[1])
Case $Button4 ;截图(多截几张不然生成的视频太短了)
For $i = 1 To 10
DllCall($dll, "int", "SaveBmp","hwnd",GUICtrlGetHandle($Pic1),"str", @ScriptDir & "" & $i & ".bmp")
Sleep(1000)
Next
Case $Button5
DllCall($dll, "int", "RecordVideo","hwnd",GUICtrlGetHandle($Pic1),"str", @ScriptDir & "\Video.avi")
Case $Button6
DllCall($dll, "int", "StopRecord","hwnd",GUICtrlGetHandle($Pic1))
Case $Button7
DllCall($dll, 'int', 'CreateVideoByFiles', 'str', @ScriptDir & '\', 'str', @ScriptDir & '\bmp.avi', 'str', 'bmp', 'int', '15')
EndSwitch
WEnd