Jump to content

CreateFile in visual studio 2008

- - - - -

  • Please log in to reply
No replies to this topic

#1
marembo

marembo

    Newbie

  • Members
  • Pip
  • 1 posts
Hey guys: I am new hear and hope to be part of this community. Now problem at hand::

I am trying to access a serial port using the CreateFile Functions as thus


this->hcomm_port = CreateFile(portName, 
		GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, overlapped?FILE_FLAG_OVERLAPPED : 0, NULL);

the overlapped boolean value defaults to false.

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




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users