Hi Andreas, If you are looking for a way to receive Windows messages like WM_ (something) then you could try adding a filter to your window .i.e. before a window's message is processed by GTK+ the window's filter func. will be called with the message and it's params from the OS, as such. You can either process it or slip it to GTK. see the GTK+ Reference Manual page for gdk_window_add_filter(). One of the parameters of the filter func. is GdkXEvent, which is the actual native OS message I.e. GdkXEvent in Windows will be MSG datatype (of windows.h), while in Linux it will be XEvent (of X11) and so on.
Hope this helps! Regards Sundaram ________________________________ Message: 1 Date: Sun, 21 Jun 2009 16:08:26 +0200 From: Andreas Ronnquist <andreas.ronnqu...@meritkonsult.se> Subject: how do I get win32 messages? To: gtk-app-devel-list@gnome.org Message-ID: <20090621160826.4e4c1c1f.andreas.ronnqu...@meritkonsult.se> Content-Type: text/plain; charset=US-ASCII Hi! I am developing a program that recieves messages from another program. The Unix/linux version is done, but I have problems with the windows version - The program sending messages is using the Windows messaging system - and now I am searching for a way to recieve the messages in a GTK program. As I have understood it, I could use the windows style WinMain and the GetMessage / TranslateMessage functionality, but then I would loose the simplicity of GTK and the gtk_main. So I search the web and find g_io_channel_win32_new_messages. Having the following code gives no good results at all: gboolean hwnd_callback(GIOChannel *source,GIOCondition condition,gpointer data) { gchar *read_data=NULL; gsize size; gsize term_pos; if (condition==G_IO_IN) { if (g_io_channel_read_line(source, &read_data,&size,&term_pos,NULL)==G_IO_STATUS_NORMAL) { if (size!=0) { g_print("read data: %s\n",read_data); g_free(read_data); } } } return TRUE; } /** * */ void init_connection() { GtkWidget *window=get_main_window(); HWND hwnd=(HWND)(GDK_WINDOW_HWND(GTK_WIDGET(window)->window)); windows_messages_channel=g_io_channel_win32_new_messages((guint)hwnd); g_io_add_watch (windows_messages_channel,G_IO_IN,hwnd_callback,NULL); } This gives some reaction, but I cannot interpret it. Does anyone have something like this working? Thanks in advance -- Andreas Ronnquist <andreas.ronnqu...@meritkonsult.se> _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list