Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Calling ASCII or Unicode version of Windows APIs
xalam last edited by
I am converting a Visual Studio C++ demo that works with USB devices. Now Windows has ANSII and UNICODE version of APIs, this is giving me a lot of trouble.
C:\code\MyProject\USBDevices.cpp:374: error: C2664: 'USBDevices::EnumerateHostController' : cannot convert parameter 3 from 'WCHAR ' to 'PCHAR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
My question is if I have a structure defined as:
Can I set settings in Qt somewhere to use SP_DEVICE_INTERFACE_DATA_W rather than SP_DEVICE_INTERFACE_DATA_A like Visual Studio does?
hskoglund last edited by hskoglund
Hi, actually I think there is only one
SP_DEVICE_INTERFACE_DATAstructure without _A and _W suffixes (normally A and W are appended for functions, not structures).
Maybe instead there's a problem with your Unicode settings, usually Qt only defines UNICODE and not _UNICODE which sometimes Windows wants as well.
Edit: Here's a good explanation about the UNICODE and _UNICODE defines.