CreateFile

Hey guys, I am trying to access a serial port using the CreateFile Functions as thus
1
2
this->hcomm_port = CreateFile(portName, 
		GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, overlapped?FILE_FLAG_OVERLAPPED : 0, NULL);


My problem is that it returns a valid handle, but when i debug, it seems as
though the call to CreateFile runs under a thread, and the CMD does not close
after the above line is executed.

Subsequently, the returned handle to the port does not write well to the port
however, check to the INVALID_HANDLE_VALUE returns that the handle is valid, how else can i check for its validity and if it points to the write port
cause it cant write to the port properly
This is delaying a deployment of an Application badly
Help will be highly appreciated

And a call to GetLastError returns operation completed successfully
Last edited on
I don't remember any instance where a thread is implicitly created by a call to Win32 API. What happens when you run exe file? Does it close?

Usually program does not terminate after last line of code (visible to you). There are house keeping codes waiting.
Topic archived. No new replies allowed.