
PortDCB.fParity = FALSE;
// Disable parity checking.
PortDCB.fOutxCtsFlow = TRUE;
// CTS output flow control
PortDCB.fOutxDsrFlow = TRUE;
// DSR output flow control
PortDCB.fDtrControl = TRUE;
// DTR flow control type
PortDCB.fDsrSensitivity = FALSE;
// DSR sensitivity
PortDCB.fTXContinueOnXoff = TRUE;
// XOFF continues Tx
PortDCB.fOutX = FALSE;
// No XON/XOFF out flow control
PortDCB.fInX = FALSE;
// No XON/XOFF in flow control
PortDCB.fErrorChar = FALSE;
// Disable error replacement.
PortDCB.fNull = FALSE;
// Disable null stripping.
PortDCB.fRtsControl = TRUE;
// RTS flow control
PortDCB.fAbortOnError = FALSE;
// Do not abort reads/writes on error.
PortDCB.ByteSize = 8;
// Number of bits/bytes, 4-8
PortDCB.Parity = NOPARITY;
// 0-4=no,odd,even,mark,space
PortDCB.StopBits = ONESTOPBIT;
// 0,1,2 = 1, 1.5, 2
// Configure the port according to the specifications of the DCB structure.
if (!SetCommState(SerialChannel, &PortDCB))
{
MessageBox (ParentWindowHandle, TEXT("Unable to configure the serial
port"), ERROR_TEXT, MB_OK);
dwError = GetLastError ();
return FALSE;
}
// Retrieve the time-out parameters for all read and write operations on the port.
GetCommTimeouts(SerialChannel, &Timeouts);
// These timeout values have been changed: 2007-04-10
Timeouts.ReadIntervalTimeout = 50L;
// Specify time-out between character
//for receiving.
Timeouts.ReadTotalTimeoutMultiplier = 5L;
// Specify value that is multiplied by
// the requested number of bytes to be
// read.
Timeouts.ReadTotalTimeoutConstant = 5000L;
// Specify value is added to the
// product of the
// ReadTotalTimeoutMultiplier member
Timeouts.WriteTotalTimeoutConstant = 5L;
// Specify value that is multiplied by
// the requested number of bytes to
// be sent.
Timeouts.WriteTotalTimeoutMultiplier = 5000L;
// Specify value is added to the
// product of the
// WriteTotalTimeoutMultiplier member
SetCommTimeouts(SerialChannel, &Timeouts);
// Set the time-out parameters for all read and write operations on the port.
if (!SetCommTimeouts (SerialChannel, &Timeouts))
{
MessageBox (ParentWindowHandle, TEXT("Unable to set the time-out
parameters"), ERROR_TEXT, MB_OK);
dwError = GetLastError ();
return FALSE;
}
// Create a read thread for reading data from the IrDA port
if (ReadThreadHandle = CreateThread(NULL, 0, SerialReadThread, 0, 0, &ThreadID))
{
CloseHandle(ReadThreadHandle);
}
else
{
// Could not create the read thread.
MessageBox(ParentWindowHandle, TEXT("Unable to create the serial read
thread"), ERROR_TEXT, MB_OK);
dwError = GetLastError ();
return FALSE;
}
return TRUE;
}
// --------------------------------------------------------------------------------------
Содержание Pro60
Страница 1: ...Blackroc Pro60 Thermal Printer Programming Manual March 2007 V1 4 ...
Страница 21: ...DeleteObject BitmapHandle return TRUE ...
Страница 24: ...Windows Mobile 2003 ...
Страница 25: ......
Страница 26: ...Alphabetical Index ...