E语言开启摄像头源码,易语言
.版本 2
.程序集 窗口程序集1
.程序集变量 hWndC, 整数型
.子程序 _视频窗口_创建完毕
.局部变量 hwnd, 整数型
hwnd = 视频窗口.取窗口句柄 ()
hWndC = capCreateCaptureWindow (“My Own Capture Window”, 位异或 (#WS_CHILD, #WS_VISIBLE), 2, 2, 320, 240, hwnd, 0)
SendMessage (hWndC, #WM_CAP_SET_CALLBACK_VIDEOSTREAM, 0, 0)
SendMessage (hWndC, #WM_CAP_SET_CALLBACK_ERROR, 0, 0)
SendMessage (hWndC, #WM_CAP_SET_CALLBACK_STATUSA, 0, 0)
SendMessage (hWndC, #WM_CAP_DRIVER_CONNECT, 0, 0)
SendMessage (hWndC, #WM_CAP_SET_SCALE, 1, 0)
SendMessage (hWndC, #WM_CAP_SET_PREVIEWRATE, 66, 0)
SendMessage (hWndC, #WM_CAP_SET_OVERLAY, 1, 0)
SendMessage (hWndC, #WM_CAP_SET_PREVIEW, 1, 0)
.子程序 _按钮1_被单击
.如果真 (hWndC ≠ 0)
SendMessageStr (hWndC, #WM_CAP_SAVEDIB, 0, “c:\test.bmp”)
.如果真结束
.子程序 _按钮2_被单击
.如果真 (hWndC ≠ 0)
SendMessageStr (hWndC, #WM_CAP_FILE_SET_CAPTURE_FILEA, 0, “c:\test.avi”)
SendMessage (hWndC, #WM_CAP_SEQUENCE, 0, 0)
.如果真结束
.子程序 _按钮3_被单击
.如果真 (hWndC ≠ 0)
SendMessage (hWndC, #WM_CAP_STOP, 0, 0)
.如果真结束
.子程序 _视频窗口_将被销毁
.如果真 (hWndC ≠ 0)
SendMessage (hWndC, #WM_CAP_DRIVER_DISCONNECT, 0, 0)
.如果真结束