Camera Capturar
C:\WinDev 19\Examples\Complete examples\WD WebCam\Exe
IF gbCaptureInProgress = True THEN
Info("A recording is in progress")
RETURN
END
// Save the video broadcasted in the Video control
IF NOT VideoCapture(CAM_VIDEO,CompleteDir(fExeDir())+"Temp.bmp",viPictureCapture) THEN
Error(ErrorInfo())
RETURN
END
// Retrieve the last directory used
IF gsLastCaptureDirectoroy~="" THEN
gsLastCaptureDirectoroy = fCurrentDir()
END
// Renames the AVI file
sFileName is string = fSelect(gsLastCaptureDirectoroy, "", "Save as...", "Image (*.bmp)"+TAB+"*.bmp"+CR+"All files (*.*)"+TAB+"*.*", "bmp", fselCreate+fselExist)
IF sFileName~="" THEN
// Delete the temporary file
fDelete(CompleteDir(fExeDir())+"Temp.bmp")
ELSE
// Rename and move the generated file
IF sFileName~=CompleteDir(fExeDir())+"Temp.bmp" THEN
// The file is already OK
ELSE
// If a file with the same name as the destination file exists, delete it
IF fFileExist(sFileName) THEN fDelete(sFileName)
// Rename the temporary file to the selected name
fRename(CompleteDir(fExeDir())+"Temp.bmp",sFileName)
END
// Store the directory
gsLastCaptureDirectoroy = fExtractPath(sFileName,fDrive+fDirectory)
END
CASE EXCEPTION:
sErrMsg is string = ErrorInfo()
IF sErrMsg~="" THEN sErrMsg="The WebCam is not responding."+CR+"Check whether it is plugged in properly and whether its driver is installed."
Error(sErrMsg)
ReturnToCapture()
Nenhum comentário:
Postar um comentário