in visual basic there is a mscomm control for com ports, is there a class in c++ that does the same thing? trying to write to a hardware device connected to a com port. im using ms visual c++
thanks
in visual basic there is a mscomm control for com ports, is there a class in c++ that does the same thing? trying to write to a hardware device connected to a com port. im using ms visual c++
thanks
You can CreateFile to open a handle to the COM port and then you can read and write to the port just as you do with files.
There are also rs232 developers kits that have classes for data communications. Do a search at google.
Blue
Take a look at MSDN Library and especially at the article called:
Serial Communications in Win32
Allen Denver
Microsoft Windows Developer Support
December 11, 1995
By the way, you could use CreateFile like this:
Code:HANDLE hComm; hComm = CreateFile( gszPort, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0); if (hComm == INVALID_HANDLE_VALUE) // error opening port; abort
does the 2 zero's there mean comm1?
and another thing, i have bought $200 worth of books, if i buy another one that tells me how to say hello in dos and how to make databases, i am going to scream lol any ideas on an actual real world programming book?
I've had some frustrating experiences with serial communication over the years. I cant say that I can handle it good either, but here you have the source code for my rs232 class, used in an experimental project. I dont assure any level of quality, you have to add error handling as you think appropriate for your application. And, I remember that I mixed some with the timeout values, you may be better of removing that part of the code.
The Send() function uses a record length, this was a application-specific functionality that you might not need.
Good Luck!
As an addition to this thread, whilst in a TAPI setup, using getLineID, I return a handle to the device, through which a modem is comminucating with a modem (vice versa). This returns a handle which can be used as though called from CreateFile.
Big problems occur when attempting to readfile, in non-overlapped method.
Any help?