BuildCommDCBAndTimeouts

【勇芳软件工作室】汉化HomePreviousNext

BuildCommDCBAndTimeouts功能将设备定义字符串转换为适当的设备控制块代码,然后将这些代码放入设备控制块。该函数还可以为设备设置超时值,包括无超时的可能性;在这方面,功能的行为根据设备定义字符串的内容而有所不同。

BOOL BuildCommDCBAndTimeouts(

LPCTSTR 【lpDef】,//指向设备控制字符串的指针
LPDCB 【lpDCB】,//指向设备控制块的指针
LPCOMMTIMEOUTS 【lpCommTimeouts】//指向comm的指针。超时结构
); 

参数

【lpDef】

指向指定设备的设备控制信息的空终止字符串的指针。该函数使用此字符串,解析它,然后在【lpDCB】指向的DCB结构中设置适当的值。

【lpDCB】

指向DCB结构的指针,该函数填充【lpDef】指向的设备控制信息字符串中的信息。该DCB结构定义了通信设备的控制设置。

【lpCommTimeouts】

指向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.

返回值

如果函数成功,返回值不为零。

如果函数失败,返回值为零。要获取扩展错误信息,请调用GetLastError.

也可以看看

BuildCommDCB, COMMTIMEOUTS, DCB, GetCommTimeouts, SetCommTimeouts