Board index » Visual Studio » Serial Driver Code in C++

Serial Driver Code in C++

Visual Studio383
I am trying to send a string over serial RS-232 to another

computer and

wanted to use VC++. Is there some sample code/template I

could follow ?



It is not very complicated... just somethign that opens

the port and writes

into it.... and closes the port.



Thanks

-k


-
 

Re:Serial Driver Code in C++

On Wed, 13 Aug 2003 21:16:46 -0700, "KP" <drkcp@yahoo.com>wrote:



Quote
I am trying to send a string over serial RS-232 to another

computer and

wanted to use VC++. Is there some sample code/template I

could follow ?



It is not very complicated... just somethign that opens

the port and writes

into it.... and closes the port.



Thanks

-k



Sorry about the partial message. I hit the wrong button at the wrong

time.



Use CreateFile() to open the port, WriteFile() to write, and

CloseHandle() to close. To change baud rate, parity, and stuff, use

SetCommState(). Your documentation will have information on how to

use these functions. Particularly read the help file stuff on using

CreateFile with communations resources.





-

Re:Serial Driver Code in C++

Take a look at naughter's CSerialPort class.



www.naughter.com/serialport.html">www.naughter.com/serialport.html



--

Cheers

Check Abdoul [ VC++ MVP ]

-----------------------------------



"KP" <drkcp@yahoo.com>wrote in message

Quote
I am trying to send a string over serial RS-232 to another

computer and

wanted to use VC++. Is there some sample code/template I

could follow ?



It is not very complicated... just somethign that opens

the port and writes

into it.... and closes the port.



Thanks

-k







-

Re:Serial Driver Code in C++

Thanks.. it was very helpful





Quote
-----Original Message-----

On Wed, 13 Aug 2003 21:16:46 -0700, "KP"

<drkcp@yahoo.com>wrote:



>I am trying to send a string over serial RS-232 to

another

>computer and

>wanted to use VC++. Is there some sample code/template

I

>could follow ?

>

>It is not very complicated... just somethign that opens

>the port and writes

>into it.... and closes the port.

>

>Thanks

>-k



Sorry about the partial message. I hit the wrong button

at the wrong

time.



Use CreateFile() to open the port, WriteFile() to write,

and

CloseHandle() to close. To change baud rate, parity, and

stuff, use

SetCommState(). Your documentation will have information

on how to

use these functions. Particularly read the help file

stuff on using

CreateFile with communations resources.





.



-