Exemplo n.º 1
0
        //   start   the   web   camera
        public void StartWebCam()
        {
            byte[] lpszName = new byte[100];
            byte[] lpszVer  = new byte[100];

            showVideo.capGetDriverDescriptionA(0, lpszName, 100, lpszVer, 100);
            this.lwndC = showVideo.capCreateCaptureWindowA(lpszName, showVideo.WS_VISIBLE + showVideo.WS_CHILD, 0, 0, mWidth, mHeight, mControlPtr, 0);

            if (this.capDriverConnect(this.lwndC, 0))
            {
                this.cappreviewrate(this.lwndC, 66);
                this.capPreview(this.lwndC, true);
                showVideo.bitmapinfo bitmapinfo = new showVideo.bitmapinfo();
                bitmapinfo.bmiHeader.biSize     = showVideo.SizeOf(bitmapinfo.bmiHeader);
                bitmapinfo.bmiHeader.biWidth    = 352;
                bitmapinfo.bmiHeader.biHeight   = 288;
                bitmapinfo.bmiHeader.biPlanes   = 1;
                bitmapinfo.bmiHeader.biBitCount = 24;
                this.capsetvideoformat(this.lwndC, ref bitmapinfo, showVideo.SizeOf(bitmapinfo));

                this.mFrameEventHandler = new showVideo.FrameEventHandler(framecallback);
                this.capSetCallbackOnFrame(this.lwndC, this.mFrameEventHandler);
                showVideo.SetWindowPos(this.lwndC, 0, 0, 0, mWidth, mHeight, 6);
            }
        }
Exemplo n.º 2
0
 private bool capsetvideoformat(IntPtr hcapwnd, ref showVideo.bitmapinfo bmpformat, int CapFormatSize)
 {
     return(showVideo.SendMessage(hcapwnd, showVideo.WM_CAP_SET_VIDEOFORMAT, CapFormatSize, ref bmpformat));
 }