GTK window and DLL ?



Hi all,

I'd like to associate a GTK window with a dll under Windows XP.
What I want to do is that the GTK window retrieves the messages emited from
the dll.
I wrote (just for testing) a dll wich start a timer and send a message to
the host window (my GTK window in this case) each second .

I know I have to use the gdk_window_add_filter function, but I don 't know
how to translate my GTK window to a Windows handle (HWND) and get an ID in
order to receive the messages from the dll.

I found a macro in the gdkwin32.h file that would be able to do the job: 

/* Translate from drawable to Windows handle */ 
064 HGDIOBJ  gdk_win32_drawable_get_handle (GdkDrawable *drawable);

but it doesn't work.

Here is some parts of my code:
in the main function:

HWND hWnd; 
hWnd = (HWND)gdk_win32_drawable_get_handle(myApp.pWin->window); 
gdk_window_add_filter(myApp.pWin->window, msgFunc, &myApp); 
timer(hWnd); //start the timer

and my filter function:

GdkFilterReturn msgFunc (GdkXEvent *xevent,GdkEvent *event, gpointer
userData) 
{ 
  APPLICATION *pApp = (APPLICATION*)userData; 
  MSG *WndMsg = (MSG*) xevent; 
  if(WndMsg->message == DLL_MSG) 
  { 
   addText(pApp->pDrawArea, "DLL Message!", userData); //Display text each
time a message is sent
  } 
  return GDK_FILTER_CONTINUE; 
} 

it seems that the GTK window doesn't receive any messages from the dll.
Can somebody help me ?

Thanks for advance
-- 
View this message in context: http://www.nabble.com/GTK-window-and-DLL---tf2168964.html#a5996953
Sent from the Gtk+ - General forum at Nabble.com.




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