--http://topic.csdn.net/t/20060824/15/4972908.html
http://topic.csdn.net/t/20060824/10/4971951.html
我遇到了与楼主同样的问题,但是看不到是怎么解决的,希望看到此问题的高手帮助我解决一下这个问题吧,非常感谢
我的邮箱:chunjing.gao@163.com
一个调用摄像头的程序,如果把程序放到mainform,退出后再加载摄像头没有问题。
但是如果把摄像头程序作为一个子窗口FORM1,用this.close()关闭FORM1后再进入FORM1,
摄像头就加载不了了,this.Close()和aplication.exit()效果不一样?
我使用的是codeproject里的catchitv例子,请高手指教
找到一个释放函数:但是怎么释放不了呀。
void CloseInterfaces()
{
int hr;
try
{
#if DEBUG
if( rotCookie != 0 )
DsROT.RemoveGraphFromRot( ref rotCookie );
#endif
if( mediaCtrl != null )
{
hr = mediaCtrl.Stop();
mediaCtrl = null;
}
if( mediaEvt != null )
{
hr = mediaEvt.SetNotifyWindow( IntPtr.Zero, WM_GRAPHNOTIFY, IntPtr.Zero );
mediaEvt = null;
}
if( videoWin != null )
{
hr = videoWin.put_Visible( DsHlp.OAFALSE );
hr = videoWin.put_Owner( IntPtr.Zero );
videoWin = null;
}
baseGrabFlt = null;
if( sampGrabber != null )
Marshal.ReleaseComObject( sampGrabber ); sampGrabber = null;
if( capGraph != null )
Marshal.ReleaseComObject( capGraph ); capGraph = null;
if( graphBuilder != null )
Marshal.ReleaseComObject( graphBuilder ); graphBuilder = null;
if( capFilter != null )
Marshal.ReleaseComObject( capFilter ); capFilter = null;
if( capDevices != null )
{
foreach( DsDevice d in capDevices )
d.Dispose();
capDevices = null;
}
}
catch
{}
}
浙公网安备 33010602011771号