I was wondering how to intercept a WM_ specific message into a C++ class, I need to use the RegisterDeviceNotification function to register a specific WM_ message (I need a window here right?) and then intercept it and call the appropriate function
The C++ class should be included in any project, from a console one to a win32 to a mfc one. My idea is to create the skeleton of a win32 window and then use the WndProc for that window, is this stupid?
I'm not sure I understand your point. You would normally use RegisterDeviceNotification() API in a service application to receive device notifications only. (I believe you can use it with a simple windowed-app as well, in which case all notifications will be sent via the WM_DEVICECHANGE message to its main window.)
I need to intercept WM_DEVICECHANGE in my C++ class. The purpose of this class was to let everyone use a HID device more easily (a wrapper for the HID apis)
So I am asking myself: why a device change event should be monitored via windows? Why do I have to use a win32 window (or a mfc window) to intercept the device change message? Isn't it stupid? A console application won't be able to use my HID class and communicate with a device without having a window associated, right? That's absolutely stupid, there must be something I don't really know in-depth
That's why I told you that you need to use a service application for that. To be honest with you the primary application of the RegisterDeviceNotification() API is for services, the window message is provided on the side.