View Full Version : QT conmunication with a USB device

24th July 2015, 09:33
HI ,guys
I get job last week;the Manager want me to transplant a vc6 project into Qt;
I got all the codes;
but here is a question I come across:
in vc6 we can send a control message to a usb device by function "DeviceIoControl" in MSDN:
The DeviceIoControl function sends a control code directly to a specified device driver, causing the corresponding device to perform the corresponding operation.

BOOL DeviceIoControl(
HANDLE hDevice, // handle to device
DWORD dwIoControlCode, // operation
LPVOID lpInBuffer, // input data buffer
DWORD nInBufferSize, // size of input data buffer
LPVOID lpOutBuffer, // output data buffer
DWORD nOutBufferSize, // size of output data buffer
LPDWORD lpBytesReturned, // byte count
LPOVERLAPPED lpOverlapped // overlapped information
I found this funcjtion in the vc project .but for a Qt project how to write/read datas into a USB device?

24th July 2015, 11:46
There is no difference.

That is the system's C API, it should be available in a C++ program no matter if it is using Qt or some other C++ based framework.


24th July 2015, 17:29
You just have to make sure you include the same header files and link to the same libraries for these functions in your Qt project.