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.)
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.
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 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? :)