예제 #1
0
 private bool SetTimeouts(IntPtr hComDevice)
 {
     if (((int) hComDevice) <= 0)
     {
         return false;
     }
     try
     {
         COMMTIMEOUTS lpCommTimeouts = new COMMTIMEOUTS { ReadIntervalTimeout = m_ReadIntervalTimeout, ReadTotalTimeoutMultiplier = m_ReadTotalTimeoutMultiplier, ReadTotalTimeoutConstant = m_ReadTotalTimeoutConstant, WriteTotalTimeoutMultiplier = m_WriteTotalTimeoutMultiplier, WriteTotalTimeoutConstant = m_WriteTotalTimeoutConstant };
         if (NativeMethods.SetCommTimeouts(hComDevice, ref lpCommTimeouts) == 0)
         {
             return false;
         }
         return true;
     }
     catch
     {
         return false;
     }
 }
예제 #2
0
 internal static extern int SetCommTimeouts(IntPtr hFile, ref COMMTIMEOUTS lpCommTimeouts);