[comp.windows.ms.programmer] Using BuildCommDCB

neh@rci.dk (Niels Erik Holm) (06/06/91)

I'm writing a terminal emulator program, in which I use the BuildCommDCB
function. However I've experienced some strange behaviour:

The code is something like:

	char CommSettings[] = "com1:96,n,8,1";
	DCB CommDCB;

	BuildCommDCB((LPSTR)CommSettings,&CommDCB);

I would expect that the BuildCommDCB function parses the CommSettings string
and fills in the fields in the CommDCB structure. What I get is however:

	CommDCB.BaudRate = 0x0825	// Why not 9600 ?
	CommDCB.ByteSize = 0;		// Why not 8 ?
	...
	...

If I later explicitly sets the BaudRate field to 9600 (decimal) and 
calls the SetCommState function, I get a "Invalid Baudrate" error code.

Anybode, who knows what going on ??

Best regards

Niels Erik Holm
RC International
Denmark
neh@rci.dk
---------------------------------------------------------------------------
Every day, once a day, give yourself a present. Don't plan it, don't wait
for it, just... let it happen.  Could be a new shirt at the men's store,
a catnap in your office chair, or two cups of good, hot, black coffee.
(Dale Cooper in Twin Peaks).
---------------------------------------------------------------------------