2013年6月18日 星期二
Procedure.s CapWebcam(type)
Procedure.s CapWebcam(type)
lib= OpenLibrary(#PB_Any, "avicap32.dll")
If lib
*capAddress = GetFunction(lib, "capCreateCaptureWindowA")
hWndC = CallFunctionFast(*capAddress, @"", #WS_CHILD, 0, 0, 0, 0, GetDesktopWindow_(),0)
If hWndC
If SendMessage_(hWndC, #WM_CAP_DRIVER_CONNECT, 0, 0)
If type=1
file.s=GetTemporaryDirectory()+"~"+FormatDate("%hh%ii%ss", Date())+".tmp"
SendMessage_(hWndC, #WM_CAP_FILE_SAVEDIB, 0, @file)
SendMessage_(hWndC, #WM_CAP_DRIVER_DISCONNECT, 0, 0)
image=LoadImage(#PB_Any, file)
;UsePNGImageEncoder()
UseJPEGImageEncoder()
;SaveImage(image,file,#PB_ImagePlugin_PNG)
SaveImage(image,file,#PB_ImagePlugin_JPEG,2,24)
FreeImage(image)
EndIf
Else
file="no"
EndIf
DestroyWindow_(hWndC)
EndIf
CloseLibrary(lib)
EndIf
ProcedureReturn file
EndProcedure
Debug CapWebcam(1)
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言