-
August 13th, 2009, 05:54 PM
#1
Intercept a WM_ message into a class
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?
Is there any (surely) better solution?
-
August 13th, 2009, 07:33 PM
#2
Re: Intercept a WM_ message into a class
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.)
What kinds of messages do you need to intercept?
-
August 14th, 2009, 09:46 AM
#3
Re: Intercept a WM_ message into a class
Thank you for your interest.
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
-
August 14th, 2009, 06:24 PM
#4
Re: Intercept a WM_ message into a class
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.
-
August 17th, 2009, 09:49 AM
#5
Re: Intercept a WM_ message into a class
Okay, solution is on the way. I'll start working asap and if I have more problems I'll let you know
Thanks
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|