/// <summary> /// 捕捉视频 /// </summary> /// <param name="control"></param> /// <param name="index"></param> public VideoCapturer(Control control, int index) { this.index = index; m_hwnd = capCreateCaptureWindow("", WS_VISIBLE | WS_CHILD, 0, 0, control.Width, control.Height, control.Handle, 0); if (m_hwnd == IntPtr.Zero) throw new AVException(); m_parms = new CaptureParms(); m_streamCallBack = new capVideoStreamCallback(this.streamCallBack); m_errorCallBack = new capErrorCallback(this.capErrorCallback); SendMessage(m_hwnd, WM_CAP_SET_CALLBACK_VIDEOSTREAM, 0, m_streamCallBack); SendMessage(m_hwnd, WM_CAP_SET_CALLBACK_ERRORA, 0, m_errorCallBack); }
/// <summary> /// 捕捉视频 /// </summary> /// <param name="control"></param> /// <param name="index"></param> public VideoCapturer(Control control, int index) { this.index = index; m_hwnd = capCreateCaptureWindow("", WS_VISIBLE | WS_CHILD, 0, 0, control.Width, control.Height, control.Handle, 0); if (m_hwnd == IntPtr.Zero) { throw new AVException(); } m_parms = new CaptureParms(); m_streamCallBack = new capVideoStreamCallback(this.streamCallBack); m_errorCallBack = new capErrorCallback(this.capErrorCallback); SendMessage(m_hwnd, WM_CAP_SET_CALLBACK_VIDEOSTREAM, 0, m_streamCallBack); SendMessage(m_hwnd, WM_CAP_SET_CALLBACK_ERRORA, 0, m_errorCallBack); }
static extern int SendMessage( IntPtr hwnd, int wMsg, int wParam, capVideoStreamCallback lParam );
static extern int SendMessage( IntPtr hwnd, int wMsg, int wParam, capVideoStreamCallback lParam );