代码的目的是在C#的一个panel中显示视频流,而视频流来自于一个C++写的dll。
CaptureVideo()是启动摄像头,并且获得视频流的方法。
ghApp是DLL中视频流的一个窗口句柄。
想知道如何在C#中,在panel中显示ghApp所获得的视频流?
在C++中只要ghApp = createWindow(……),再使用showWindow(ghAPP,c*win)就可以用主窗口浏览摄像头的视频流了。现在C#的代码如下:
        [DllImport("PlayCapDLL4.dll")]
        static extern int CaptureVideo();
        static IntPtr ghApp;
        
    
        private void OpenCapture()
        {
            int intWidth = this.panel3.Width;
            int intHeight = this.panel3.Height;
            CaptureVideo();
            ghApp = panel3.Handle  ;
          
        }
执行之后会弹出两个窗口,一个是之前用C#写好的窗口,里面包含有panel,另外一个是看不到窗口的ActiveMovie Window。