Setupcomm This function initializes the communication parameters for a specified communication device. BOOL Setupcomm (HANDLE hfile,dword dwinqueue,dword dwoutqueue), parameter Hfile[in] communication device handle. The CreateFile function returns this handle. Dwinqueue[in] Specifies the recommended size, in bytes, of the internal input buffer to the device. Dwoutqueue[in] Specifies the recommended size, in bytes, of the internal output buffer to the device. return value
Non-zero indicates success. Zero indicates failure. To get more error information, call the GetLastError function
PurgeComm () function--empty buffer This function prototype: BOOL PurgeComm (HANDLE hfile,dword dwFlags) HANDLE hfile//serial handle DWORD dwFlags// Action parameters to be completed dwflags specifies the action to be completed, which can be a combination of the following values: Purge_txabort terminates all in-progress character output operations, completes an overlapped I/O operation that is in the waiting state, and generates an event indicating that the write operation was completed Purge_ Rxabort terminates all ongoing character input operations, completes an in-progress overlapped I/O operation, and has an appropriately set event purge_txclear This command directs the device driver to clear the output buffer, often with purge_txabort Command flags used together with Purge_rxclear This command is used by the device driver to clear the input buffer and is often used with the Purge_rxabort command flag
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Setupcomm and PurgeComm function of serial port