getting a (valid) HWND from a Gtk::Window

Hello I've found less than a handful of threads on this issue on the entire
web. Perhaps this time this question will receive an answer from a win32
gtkmm dev? I hope so :-)

The question is how to get a valid HWND handle from a Gtk::Window.

I've tried using code I found elsewhere:

// Retrieve GdkWindow part of myWin.
GdkWindow* gdkWinPtr = my_gtk_window.get_window()->gobj();
// Retrieve Win32 application instance handle and window handle.
HWND hWnd = static_cast<HWND>(GDK_WINDOW_HWND(gdkWinPtr));

which compiles fine but when I pass the hWnd object to a recepient making
use of it (in this case the cross-platform Object-oriented Input System OIS)
it throws an invalid HWND exception.

the only member of the hWnd variable is unused with value 0.

it seems the guy who came up with that piece of code had little luck aswell:

Is there a way to get a valid HWND handle from gtk+/gtkmm?

Thank you kindly

View this message in context:
Sent from the Gtkmm mailing list archive at

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