예제 #1
0
        /// <summary>
        /// 开始录像
        /// </summary>
        /// <param name="path">要保存录像的路径</param>
        public void StarKinescope(string path)
        {
            IntPtr hBmp = Marshal.StringToHGlobalAnsi(path);

            VideoAPI.SendMessage(lwndC, VideoAPI.WM_CAP_FILE_SET_CAPTURE_FILEA, 0, hBmp.ToInt32());
            VideoAPI.SendMessage(lwndC, VideoAPI.WM_CAP_SEQUENCE, 0, 0);
        }
예제 #2
0
 /// <summary>
 /// 打开视频设备
 /// </summary>
 public void StartWebCam()
 {
     byte[] lpszName = new byte[100];
     byte[] lpszVer  = new byte[100];
     VideoAPI.capGetDriverDescriptionA(0, lpszName, 100, lpszVer, 100);
     this.lwndC = VideoAPI.capCreateCaptureWindowA(lpszName, VideoAPI.WS_CHILD | VideoAPI.WS_VISIBLE, 0, 0, mWidth, mHeight, mControlPtr, 0);
     if (VideoAPI.SendMessage(lwndC, VideoAPI.WM_CAP_DRIVER_CONNECT, 0, 0))
     {
         VideoAPI.SendMessage(lwndC, VideoAPI.WM_CAP_SET_PREVIEWRATE, 100, 0);
         VideoAPI.SendMessage(lwndC, VideoAPI.WM_CAP_SET_PREVIEW, true, 0);
     }
 }
예제 #3
0
        /// <summary>
        /// 拍照
        /// </summary>
        /// <param name="hWndC"></param>
        /// <param name="path">要保存bmp文件的路径</param>
        public void GrabImage(IntPtr hWndC, string path)
        {
            IntPtr hBmp = Marshal.StringToHGlobalAnsi(path);

            VideoAPI.SendMessage(lwndC, VideoAPI.WM_CAP_SAVEDIB, 0, hBmp.ToInt32());
        }
예제 #4
0
 /// <summary>
 /// 关闭视频设备
 /// </summary>
 public void CloseWebcam()
 {
     VideoAPI.SendMessage(lwndC, VideoAPI.WM_CAP_DRIVER_DISCONNECT, 0, 0);
 }
예제 #5
0
 /// <summary>
 /// 停止录像
 /// </summary>
 public void StopKinescope()
 {
     VideoAPI.SendMessage(lwndC, VideoAPI.WM_CAP_STOP, 0, 0);
 }