[Qt-interest] How to use Windows Message System in Qt/Win Application?

Matthias Pospiech matthias.pospiech at gmx.de
Fri Jun 18 13:18:49 CEST 2010


Robert Hairgrove schrieb:
> Check out the docs for this:
> QCoreApplication::winEventFilter ( MSG * msg, long * result );
>
> and this:
> QCoreApplication::setEventFilter ( EventFilter filter );
>   
Sadly I still have not seen a single real world example of its usage.

I am trying to do this:

QMicosPolluxController::QMicosPolluxController()
{
    QCoreApplication::setEventFilter(MicosEventFilter);
}

|bool QMicosPolluxController::MicosEventFilter(void *message, long *result)
 {
     if ((*message) == WMU_ASYNCMSG) {
         emit moveFinished();
     }
     return true;
 }
|
Which does _not_ work. 

error: no matching function for call to 'QCoreApplication::setEventFilter(<unresolved overloaded function type>)'

error: 'void*' is not a pointer-to-object type

Also the Qt Docs include the following:
"The event filter function set here is called for all messages received 
by all threads meant for all Qt objects. It is /not/ called for messages 
that are not meant for Qt objects."

1. I have no interest in any other message than a single one. What 
happens to all other messages? Do I have to handle this?
2. It says "/not/ called for messages that are not meant for Qt 
objects." which would mean that I can _not_ use it.

Can somebody please help me to understand how to catch Windows Messages 
and translate it into a standard Qt Signal?

Matthias



More information about the Qt-interest-old mailing list