1 using Cognex.VisionPro.FGGigE; 2 using Cognex.VisionPro.FGGigE.Implementation.Internal; 3 //关闭相机连接,防止程序报错 4 CogFrameGrabberGigEs cameras = new CogFrameGrabberGigEs(); 5 6 try 7 { 8 foreach (CogFrameGrabberGigE item in cameras) 9 { 10 item.Disconnect(false); 11 } 12 } 13 catch (Exception ex) 14 { 15 Log.WriteTxt(ex.Message); 16 }