ClosePort Method - neoVI API
int _stdcall icsneoClosePort(void * hObject, int * pNumberOfErrors);Public Declare Function icsneoClosePort Lib “icsneo40.dll” (ByVal hObject As IntPtr, ByRef pNumberOfErrors As Int32) As Int32[DllImport(“icsneo40.dll”)] public static extern Int32 icsneoClosePort(IntPtr hObject, ref Int32 pNumberOfErrors);Examples
int lNumberOfErrors; // used to get the number of errors
int iResult;
// Close Communication
iResult = icsneoClosePort(hObject, &iNumberOfErrors);
// Test the Result
if (iResult== 0)
MessageBox(hWnd,TEXT("Problem Closing Port"),TEXT("neoVI Example"),0);
else
MessageBox(hWnd,TEXT("Port Closed Successfully"),TEXT("neoVI Example"),0);//Declared at form level and previously open with a call to OpenNeoDevice
IntPtr m_hObject; //handle for device,
int iResult;
int iNumberOfErrors = 0;
//close the port
iResult = icsNeoDll.icsneoClosePort(m_hObject, ref iNumberOfErrors);
if (iResult == 1)
{
MessageBox.Show("Port Closed OK!");
}
else
{
MessageBox.Show("Problem ClosingPort");
}
m_bPortOpen = false;Last updated
