It's not a static method, that's one thing. The other is that it will convert the string to std::wstring, just as the name of the method says and not to a char*. The device name probably contains ascii characters only anyway, so you can probably do this:

Qt Code:
  1. QString device = "<something goes here">;
  2. QString adjustDeviceStr = "\\\\.\\"+device;
  3. QByteArray ba = adjustDeviceStr.toAscii();
  4. HComm = CreateFile(ba.constData(), ...);
To copy to clipboard, switch view to plain text mode