#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_Res_Comment=摄像头小工具
#AutoIt3Wrapper_Res_Description=摄像头小工具
#AutoIt3Wrapper_Res_Fileversion=0.1.0.3
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y
#AutoIt3Wrapper_Res_LegalCopyright=PCbar 2008.10.16
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <webcam.au3>
FileInstall("km.wav", @TempDir & '\km.wav')
#Region ### START Koda GUI section ### Form=
$title = "摄像头预览"
$Form1 = GUICreate($title, 300, 260, -1, -1)
$Button1 = GUICtrlCreateButton("拍照", 24, 230, 65, 25, 0)
$Button2 = GUICtrlCreateButton("录像", 116, 230, 65, 25, 0)
$Button3 = GUICtrlCreateButton("退出", 210, 230, 65, 25, 0)
$Label1 = GUICtrlCreateLabel("By Pcbar", 232, 0, 68, 22)
GUICtrlSetFont(-1, 10, 800, 0, "Arial Black")
GUICtrlSetState(-1, $GUI_DISABLE)
$Label2 = GUICtrlCreateLabel("正在录像", 30, 195)
$webid = _webcamopen($Form1, 20, 20, 260, 195)
If $webid = -1 Then
MsgBox(64, "出错", "创建预览窗口失败,请检查摄像头是否连接正常!", 20)
Exit
EndIf
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE, $Button3
_webcamclose($webid)
If GUICtrlRead($Button2) = "停止" Then endrec()
Exit
Case $Button1
#Region --- CodeWizard generated code Start ---
;InputBox features: Title=Yes, Prompt=Yes, Default Text=Yes, Height=130
If Not IsDeclared("sInputBoxAnswer") Then Local $sInputBoxAnswer
$sInputBoxAnswer = InputBox("拍照", "请输入保存的文件名(不含扩展名).", "Snap_" & @HOUR & @MIN & @SEC, " ", "-1", "130", "-1", "-1")
Select
Case @error = 0 ;OK - The string returned is valid
Case @error = 1 ;The Cancel button was pushed
ContinueLoop
Case @error = 3 ;The InputBox failed to open
EndSelect
#EndRegion --- CodeWizard generated code Start ---
SoundPlay(@TempDir & '\km.wav')
_webcamsnap($webid, $sInputBoxAnswer & '.bmp')
Case $Button2
If GUICtrlRead($Button2) = "录像" Then
GUICtrlSetData($Button2, "停止")
TraySetState(4)
WinSetTitle($title, "", "正在录像...")
$avifile=@ScriptDir & '\Avi_' & @HOUR & @MIN & @SEC & '.avi'
_WebcamRecordStart($avifile, $webid)
Else
endrec()
EndIf
EndSwitch
WEnd
Func endrec()
GUICtrlSetData($Button2, "录像")
TraySetState(8)
WinSetTitle("正在录像...", "", $title)
_WebcamRecordStop($webid)
TrayTip("Camera Tool","视频已保存至"&$avifile,10)
EndFunc ;==>endrec
代码如上,在WIN7下运行时就有链接处的贴子所描述的问题了,定时器在这上如何用能说明一下吗?