Reputation: 33
I'm trying to implement a nativeEventFilter to intercept windows messages in my Qt application according to the explanations provided on the official website :
https://doc.qt.io/qt-5/qabstractnativeeventfilter.html#details
However, they don't mention where/how the eventType
should be defined, nor the samples provided show any hints. Therefore, windows_dispatcher_MSG
is obviously undefined in my program.
Upvotes: 0
Views: 456
Reputation: 1343
Following a small example:
bool Foo::nativeEventFilter(const QByteArray & eventType, void * message, long * result)
{
static const QByteArray windowsDispatcherMSG("windows_dispatcher_MSG");
if (eventType != windowsDispatcherMSG)
return false;
const MSG * m = static_cast<MSG*>(message);
if (m->message != WM_DEVICECHANGE)
return false;
/** ...do something... **/
}
MSG
Upvotes: 1