
Machine Vision Camera SDK (DotNet) Developer Guide
MyCamera.MV_CC_DEVICE_INFO stDeviceInfo = new MyCamera.MV_CC_DEVICE_INFO();
nRet = device.MV_CC_GetDeviceInfo_NET(ref stDeviceInfo);
if (MyCamera.MV_OK != nRet)
{
Console.WriteLine("Get device info failed:{0:x8}", nRet);
return;
}
//Other process...
//Close device
nRet = device.MV_CC_CloseDevice_NET();
if (MyCamera.MV_OK != nRet)
{
Console.WriteLine("Close device failed{0:x8}", nRet);
return;
}
//Destroy handle and release resources
nRet = device.MV_CC_DestroyDevice_NET();
if (MyCamera.MV_OK != nRet)
{
Console.WriteLine("Destroy device failed:{0:x8}", nRet);
}
}
}
}
Example
VB
Imports System.Runtime.InteropServices
Imports System.Threading.Thread
Imports System.Net.IPAddress
Imports MvCamCtrl.NET
Module Module1
Sub Main()
Dim dev As MyCamera = New MyCamera
Dim Info As String
Dim nRet As Int32 = MyCamera.MV_OK
Dim stDeviceInfoList As MyCamera.MV_CC_DEVICE_INFO_LIST = New MyCamera.MV_CC_DEVICE_INFO_LIST
'Enumerate devices
nRet = dev.MV_CC_EnumDevices_NET((MyCamera.MV_GIGE_DEVICE Or MyCamera.MV_USB_DEVICE),
stDeviceInfoList)
If MyCamera.MV_OK <> nRet Then
Console.Writeline("Enumerating device failed!"+ Convert.ToString(nRet))
Return
End If
If (0 = stDeviceInfoList.nDeviceNum) Then
MsgBox("No Find Gige | Usb Device !")
Return
43






















































































































































































































































































































































































































































































































































































































