Example #1
0
 public void StartWebCam()     //打开视频设备
 {
     byte[] IpszName = new byte[100];
     byte[] IpszVer  = new byte[100];
     VideoAPI.capGetDriverDescriptionA(0, IpszName, 100, IpszVer, 100);
     this.IwndC = VideoAPI.capCreateCaptureWindowA(IpszName, VideoAPI.WS_CHILD | VideoAPI.WS_VISIBLE, 0, 0, mWidth, mHeight, mControlPtr, 0);
     if (VideoAPI.SendMessage(IwndC, VideoAPI.WM_CAP_DRIVER_CONNECT, 0, 0))
     {
         VideoAPI.SendMessage(IwndC, VideoAPI.WM_CAP_SET_PREVIEWRATE, 100, 0);
         VideoAPI.SendMessage(IwndC, VideoAPI.WM_CAP_SET_PREVIEW, true, 0);
     }
 }
Example #2
0
        public void GrabImage(IntPtr hWndC, string path)   //拍照
        {
            IntPtr hBmp = Marshal.StringToHGlobalAnsi(path);

            VideoAPI.SendMessage(IwndC, VideoAPI.WM_CAP_SAVEDIB, 0, hBmp.ToInt32());
        }
Example #3
0
 public void CloseWebcam()   //关闭视频设备
 {
     VideoAPI.SendMessage(IwndC, VideoAPI.WM_CAP_DRIVER_DISCONNECT, 0, 0);
 }