+#ifdef G_OS_WIN32
+
+static gboolean
+recv_windows_message (GIOChannel *channel,
+ GIOCondition cond,
+ gpointer data)
+{
+ GIOError error;
+ MSG msg;
+ guint nb;
+
+ while (1)
+ {
+ error = g_io_channel_read (channel, &msg, sizeof (MSG), &nb);
+
+ if (error != G_IO_ERROR_NONE)
+ {
+ g_print ("gio-test: ...reading Windows message: G_IO_ERROR_%s\n",
+ (error == G_IO_ERROR_AGAIN ? "AGAIN" :
+ (error == G_IO_ERROR_INVAL ? "INVAL" :
+ (error == G_IO_ERROR_UNKNOWN ? "UNKNOWN" : "???"))));
+ if (error == G_IO_ERROR_AGAIN)
+ continue;
+ }
+ break;
+ }
+
+ g_print ("gio-test: ...Windows message for %#x: %d,%d,%d\n",
+ msg.hwnd, msg.message, msg.wParam, msg.lParam);
+
+ return TRUE;
+}
+
+LRESULT CALLBACK
+window_procedure (HWND hwnd,
+ UINT message,
+ WPARAM wparam,
+ LPARAM lparam)
+{
+ g_print ("gio-test: window_procedure for %#x: %d,%d,%d\n",
+ hwnd, message, wparam, lparam);
+ return DefWindowProc (hwnd, message, wparam, lparam);
+}
+
+#endif
+