Get windows handle?
-
I know about QWidget::winId() but the problem is it doesn't seem to work in a class that is derived from QMAinWindow
@
MainApp::MainApp(QWidget *parent, Qt::WFlags flags)
: QMainWindow(parent, flags)
{ui.setupUi(this)
RegisterDeviceNotification(this->winId(),&NotificationFilter,DEVICE_NOTIFY_WINDOW_HANDLE);
}bool MainApp::winEvent ( MSG * msg, long * result )
{
// do stuff on filtered devices
}
@This won't compile so i used this line instead
@RegisterDeviceNotification(ui.centralWidget->winId(),&NotificationFilter,DEVICE_NOTIFY_WINDOW_HANDLE);@
But it doesn't work, I don't get the filtered messages in winEvent();
-
well the class derived from QMainWindow doesn't seem to have QMainWindow::winId()
Shouldn't it get inherited by QWidget?
Is there an alternative in Qt to getting usb events and keeping track of active connections? that would probably be easier, though we don't want to use polling.
-
No, Qt has not direct driver support, so no direct possibility in Qt to get USB events.
QMainWindow is derived from QWidget, so the method "winId":http://doc.qt.nokia.com/4.7/qwidget.html#winId exists. I already used it, it exists and works. Which errors do you get if you use it?