Re: Howto handle win32 messages ?



Hi Tor,

Thanks for your reply,

Tor Lillqvist wrote:

Aurelien Minet writes:
> 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 ). I know that in win32 programming the WindowProc callback > is set with WNDCLASSEX wc; wc.lpfnWndProc = WindowProc; createwindows > .. but it isn't possible in a GTK programme.
> So what can I do ?

The answer should be to use gdk_window_add_filter() with a NULL window
to get a look at all the window messages for all windows before GDK
does, but I just noticed that this isn't implemented in the Win32
backend in 2.2.1... Will be in 2.2.2, seems pretty straightforward to
handle in the same way as the X11 backend does.

Until you have a version that correctly implements
gdk_window_add_filter(), I think you have to use
gdk_display_add_client_message_filter(), but then you have to call
that for each message number you want to handle.

> I found GIOWin32Channel and GIOWin32ChannelType (
> G_IO_WINDOWS_MESSAGES),

Those are internal to GLib, not visible to user programs.

If you were writing a non-GTK-program, you could use the
G_WIN32_MSG_HANDLE "pseudo file descriptor" in a GPollFD and pass that
to g_source_new(), but as GDK already does that, you can't.

--tml



But  I got a solution (not a very clean one), which is  :
Get the HWDN of the GTK main windows  with GDK_WINDOW_HWND .
Next  do a GetWindowLong to have the pointer of the actual WindowProc.
And finaly SetWindowLong in order to replace the actual WindowProc by my own WindowsProc that handle win32 messages I want and others with the old WindowProc.I haven't try it .


Regards

Aurelien


PS :   may gdk_window_add_filter() is out with the 2.2.2




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