Getting a Win32 window handle from a GtkWindow

Hi,

What is the equivalent of gdk_win32_drawable_get_handle in GTK+3?
I have a GtkWindow and I want to get its Win32 handle so I can load a plugin with that as a parent.
I am already doing something similar for X11 but I can’t find any info on how to do this for Win32 windows.

Each applicable GdkDrawable functionality was moved into GdkWindow, once we dropped GdkPixmap from GTK3.

GDK exports gdk_win32_window_get_handle() as a public symbol—but its declaration is not available in a public header, so you’ll have to define it yourself:

HGDIOBJ       gdk_win32_window_get_handle (GdkWindow *window);

I honestly don’t know the backstory on this; you may need to ask the Windows backend maintainers.

1 Like

The snippet above is perfectly fine. To add to the answer, if you include <gdk/gdkwin32.h> you can use the GDK_WINDOW_HWND macro.

There’s an example here: https://gstreamer.freedesktop.org/documentation/video/gstvideooverlay.html?gi-language=c#gstvideooverlay-and-gtk

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.