BuildCommDCBAndTimeouts
The BuildCommDCBAndTimeouts
function translates a device-definition string into appropriate device-control
block codes and then places these codes into a device control block. The
function can also set up time-out values, including the possibility of no
time-outs, for a device; the function s behavior in this regard varies based on
the contents of the device-definition string.
BOOL BuildCommDCBAndTimeouts(
LPCTSTR lpDef, |
// pointer to the device-control string |
LPDCB lpDCB, |
// pointer to the
device-control block |
LPCOMMTIMEOUTS lpCommTimeouts
|
// pointer to comm.
time-out structure |
); |
|
Parameters
lpDef
Pointer to a
null-terminated string that specifies device-control information for the
device. The function takes this string, parses it, and then sets appropriate
values in the DCB structure pointed to by lpDCB.
lpDCB
Pointer to a DCB
lpCommTimeouts
Pointer to a COMMTIMEOUTS
The BuildCommDcbAndTimeouts
function modifies its time-out setting behavior based on the presence or
absence of a TO=xxx substring in the string specified by lpDef:
If that string contains the substring
TO=ON , the function sets up total read and write time-out values for the
device based on the time-out structure pointed to by lpCommTimeouts.
If that string contains the substring
TO=OFF , the function sets up the device with no time-outs.
If that string contains neither of the
aforementioned TO=xxx substrings, the function ignores the time-out structure
pointed to by lpCommTimeouts. The time-out structure will not be
accessed.
Return Values
If the
function succeeds, the return value is nonzero.
If the
function fails, the return value is zero. To get extended error information,
call GetLastError
See Also