title: CreateFile() Serial Communication Issue
body: <p>I am trying to do some serial communication through my usb port (named COM15), and I am getting an error. This is the code where the error is occurring:</p>
  
  <pre><code>HANDLE myPortHandle = CreateFile("COM15",
                                    GENERIC_READ | GENERIC_WRITE,
                                    0,
                                    NULL,
                                    OPEN_EXISTING,
                                    0,
                                    NULL);
  
  if (myPortHandle == INVALID_HANDLE_VALUE)
  {
      DWORD lastError = GetLastError();
      cout&lt;&lt;"ERROR HERE! = "&lt;&lt;lastError&lt;&lt;endl;
  }
  </code></pre>
  
  <p>Every time I compile the program, the handle to the opened serial port == INVALID_HANDLE_VALUE. I read in the CreateFile() msdn documentation to use GetLastError() in order to get "extended error information". Now... when I run the code, GetLastError() returns a value of: 2</p>
  
  <p>In the msdn documentation of GetLastError(), it says:</p>
  
  <p>"The Return Value section of the documentation for each function that sets the last-error code notes the conditions under which the function sets the last-error code."</p>
  
  <p>I tried looking for the meaning of the '2' in the Return Value section of the CreateFile() msdn documentation and couldn't find the meaning anywhere.</p>
  
  <p><strong>QUESTION:</strong> </p>
  
  <p>1) Why is this happening: myPortHandle == INVALID_HANDLE_VALUE? </p>
  
  <p>2) Also, if anyone could direct me to where I need to look in the msdn documentation to find the meaning of the '2' returned by GetLastError(), that would be awesome!</p>