RE: Howto handle win32 messages ?



On Thu, 05 Jun 2003 13:40:40 +0200 Aurelien Minet wrote:

My new to GTK on WIN32 , and I want want to know how I can setup a 
callback for handling windows messages (or DLL messages of 
which I know the number ).  

Since I'm planning on adding DDE server functionality to my 
GTK+ app, I also have a need to process Win32 messages that 
GDK/GTK+ would otherwise ignore.

Here is yet another idea: install an idle function that looks for 
messages of interest with PeekMessage().  Here is what I have so 
far:

gboolean dde_idle(gpointer data)
{
    MSG msg;

    if (PeekMessage(&msg, NULL, XTYP_CONNECT, XTYP_CONNECT, PM_NOREMOVE))
    {
        OutputDebugString("Received message XTYP_CONNECT!\n");
    }
    return(TRUE);
}

    ... 
    g_idle_add(dde_idle, NULL);
    ...

Note how I'm limiting which messages I am looking for. In the
example above I'm looking for a single message (XTYP_CONNECT).
I tried peeking for all messages with 
    PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE);
and then I tried peeking for a smaller number of messages with
    PeekMessage(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_NOREMOVE);
but,  much to my surprise, both screwed up GTK+ message 
processing in interesting ways.

Why would peeking and not removing the messages screw up GTK's 
message processing?  Another undocumented Microsoft "feature"
in PeekMessage()? *sigh*

--
Ken Rastatter, Senior Design Engineer
Honeywell Sensotec
2080 Arlingate Lane, Columbus, Ohio, 43228-4112 USA
Home Page:  http://www.sensotec.com
"These opinions are mine and not necessarily those of Honeywell."



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]