I get PC blocked calling WriteFile un serial port in XP.

Someone know why?

Posted on 2002-04-12 01:01:20 by Bit7

Not sure what you mean by 'PC blocked', but I'm using XP and
CreateFile, WriteFile, and ReadFile are working fine on the serial
ports. Not only do I see the results on the machines I'm connected to, but also w/ 'Portmon.exe' from sysinternals.com

Posted on 2002-04-13 06:32:28 by DaveTX47

many thanks. This is a good start to say "problem is on my code".

I've write a little communication program.... Works great on 95-98.

On XP, pc seems to eneter into infinite loop (mouse arro change in wait.. icon) after a PurgeComm function.... I've try to skipped PurgeComm(rem) and now is the same at the following WriteFile function....

Probably there's something else not compatible on my code.....
Maybe i open the file in a wrong way.... but in 95 works good...

If you like to see, attached is the code.

Many thx B7
Posted on 2002-04-15 00:57:37 by Bit7
I never tried this under XP, but maybe ...

You use GetCommState to get an initial DCB structure for setting up new state.
Maybe, the initial state is wired under XP, try to setup an DCB with "BuildCommDCB".

Another problem may be writing a full buffer to the com port. I remember "darkly" some problems I had (during
programming an open command for a cash-drawer) with writing more than one byte at once.
My solution was to make a write loop, that wrote only one byte per WriteFile.
Posted on 2002-04-15 12:37:57 by beaster

many thanks, i will try.
Posted on 2002-04-16 01:16:43 by Bit7