RS232 communications

I'm trying to implement serial communications from an app and to test it out I wanted to write & read from the same com port by tying the TX & RX pins together(this works in Hyper terminal). My problem is that when I get to ReadFile the program hangs & I'm not good enough w/ the assembly code to figure out why...?

Dear Grailman.
I worked a lot with serial ports, sometimes it works tricky and there is no good documentation. There is also subtle difference between windows 95 and windows NT. You cannot use GetOverlappedResults

Dear Grailman.
I worked a lot with serial ports, sometimes it works tricky and there is no good documentation. There is also subtle difference between windows 95 and windows NT. You cannot use GetOverlappedResults in win 95 to get the number of bytes written to serial port. Also if you do not specify comm. events mask, then WaitCommEvents blocks in win95 and doesn't blocks in windows NT.
Now about your question. I just send you a code that opens the serial port in my program and it works. There are additional calls for initialisation, thius explains your problem:

//********************** Code copied from Moshe for tuning of port ************
DCB dcb;
dcb.DCBlength = sizeof( DCB );
GetCommState( &dcb );
//For a string such as 96,n,8,1 or any other older-form mode string
// that doesn't end with an x or a p:
// fInX, fOutX, fOutXDsrFlow,
// and fOutXCtsFlow are all set to FALSE
// fDtrControl is set to DTR_CONTROL_ENABLE
// sfRtsControl is set to RTS_CONTROL_ENABLE
dcb.BaudRate = BaudRate;
dcb.ByteSize = 8;
dcb.Parity = NOPARITY;
dcb.StopBits = ONESTOPBIT;
// Resume as if wire has not been pulled out, in case it has. If
// setting is TRUE, default, I will have to use a ClearCommError()
// in the serial thread procedure. Hmm..?
dcb.fAbortOnError=FALSE;

It is a member function of the CUMDSerPort, so instead of
SetupComm( m_inBufferSize, m_outBufferSize ) use API -
SetupComm( m_hPort, m_inBufferSize, m_outBufferSize ),
I just created wrappers in my class for all API.
If you are interested I can send you the source code for theis class. YOu can write to my e-mail igor_u@ultramind.co.il
Yours Igor

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes. I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.
Introductio…

Introduction:
Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information.
Continuing from the first article about sudoku. There we have designed the application and put a lot of user int…

Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail. The methods are covered in more detail in o…