how do I get win32 messages?
- From: Andreas Ronnquist <andreas ronnquist meritkonsult se>
- To: gtk-app-devel-list gnome org
- Subject: how do I get win32 messages?
- Date: Sun, 21 Jun 2009 16:08:26 +0200
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 ronnquist meritkonsult se>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]