Hardware update messages


#1

I’m working on a hardware control panel in JUCE, and I have to handle Windows plug and play messages in the main window. I believe I am correctly registering for the device notification event. I added a WM_DEVICECHANGE handler in juce_WndProc() and an OnDeviceChange() method to NativeDesktopWindow, which I override in my local window class, but it is never getting called. So:

a. Any idea what I am doing wrong?
b. Is there an easier way to do this? (I eventually have to do something similar for the Mac version, so I do need a generic “HardwareChanged” handler.)

Thanks.


#2

I’m working on a similar thing for Mac, having some troubles with adding notifications to the carbon run loop.


#3

I don’t know much about WM_DEVICECHANGE but can’t see a reason why it wouldn’t work if you add it to the juce_WndProc function.

If it’s not calling your subclass properly, try doing a clean rebuild because sometimes the compiler can fail to relink everything correctly when you add a virtual function.


#4

Thanks. It turns out that it’s an inheritance problem, since I assumed that the main window (DialogWindow) inherited from NativeDesktopWindow.


#5

I was just working on a similar thing. Since I’d rather not change the JUCE source, I wrote a class that created a dummy, hidden window whose sole purpose was to receive WM_DEVICECHANGE messages. Works great.

Let me know if you’d like to see the source.

Matt


#6

I was just working on a similar thing. Since I'd rather not change the JUCE source, I wrote a class that created a dummy, hidden window whose sole purpose was to receive WM_DEVICECHANGE messages. Works great.

I found this old comment of yours from 2005... you wouldn't still happen to have that code would you?  :)


#7

I think there's a class inside of the library that does this now. Steal that!


#8