Click to See Complete Forum and Search --> : How to access serial port in VC++


hraghavendra
January 4th, 2005, 03:29 AM
Hello All,

The requirement is simple. I want to access serial port and do read and write operation on it.

If anybody having sample code it is really great

Please help me

thanks and regards
Raghavendra H

Andreas Masur
January 4th, 2005, 05:57 AM
Depending on what you are trying to do take a look at the functions

BuildCommDCB()
ClearCommError()
CreateFile()
EscapeCommFunction()
GetCommModemStatus()
GetCommState()
GetCommTimeouts()
GetOverlappedResult()
ReadFile()
SetCommMask()
SetCommTimeouts()
WaitCommEvent()
WriteFile()

Additionally, the MSDN (http://msdn.microsoft.com) provides a detailed article about serial communication in Windows. Open MSDN, choose Index and type "Serial Communications". There are several subitems, choose 'Win32'... (it's also available online (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnfiles/html/msdn_serial.asp)).

lloydy
January 4th, 2005, 05:09 PM
You could use JH.CommBase. Try looking at this article http://www.codeproject.com/csharp/freakshow.asp