[Interest] Qt5 beta1 windows - can't get device notifications from a QWindow::winId() via RegisterDeviceNotification

Liam Staskawicz lstask at gmail.com
Tue Oct 16 05:34:22 CEST 2012


Hi!

I'm experimenting with porting a Qt 4.8 application I'm working on to Qt5
beta1. One task of my app is to monitor whether a particular USB device is
connected or not. I'm working on my Win7 64bit dev machine, using MSVC
Express 2010.

In Qt 4.8.3 (and earlier), I have code that works nicely for this, feeding
a QWidget::winId() into RegisterDeviceNotification (
http://msdn.microsoft.com/en-us/library/windows/desktop/aa363431(v=vs.85).aspx)
and handling the events that get dispatched via QWidget::winEvent().

In Qt5, I have tried the approach above, and do not see any events of
type WM_DEVICECHANGE dispatched via QWidget::winEvent().

I also tried changing my QWidget to a QWindow, and feeding its winId()
to RegisterDeviceNotification(), and monitoring QWindow::nativeEvent() for
events - I don't see any WM_DEVICECHANGE events here either.

Are there any known changes around this behavior between Qt4 and Qt5? Any
possible workarounds to get me detecting devices again?

Thanks!
Liam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20121015/e4739ecd/attachment.html>


More information about the Interest mailing list