PDA

View Full Version : Using mcHID.dll from a QT project



Frappucciolo
13th December 2010, 19:25
I need to read & write from a home made USB HID device with a microcontroller. The uC manufacturer provided a dll (AX dll??) along with only a dotnet VS2008 project. I need to communicate with this device from a QT project, but I was not able to compile it to use that AX dll provided. May be ActiveQT be used?

Searching I found an older version of the lib, mcHID.cll, a standard dll, that can be easily used from other languages and I managed to use it from my C++ QT project. Now I can call the dll functions so I can write to the HID device.

The problem is that I can't read from it. The thing is that this libary provides a mechanism for notifying tha application when the USB cable is connected and disconnected and this notification. The same mechanism is used to indicate that there is something to read on the USB and then call the read function. The mechanism mekes use of a custom Windows message:

#define WM_HID_EVENT WM_APP + 200
#define NOTIFY_PLUGGED 0x0001
#define NOTIFY_UNPLUGGED 0x0002
#define NOTIFY_CHANGED 0x0003
#define NOTIFY_READ 0x0004

I tried to implement an event receiver window to get the WM messages:

EventReceiverWindow::winEvent ( MSG * message, long * result )

and then I catch a lot of windows messages including the WM_DEVICECHANGE message sent when I connect/disconnect the device but can't get none of the WM_HID_EVENT I need witch the dll is supposed to send.

Is there any limitation on the type of messages that my QT app can receive?. What am I doing wrong?

Any suggestion or help on this would be appreciated.