ZeroZerg
ZeroZerg

Reputation: 457

How to get HWND with GLFWwindow pointer?

I have the pointer of a GLFWwindow(It is a struct defined in glfw3.h, seems to be a openGL struct?). How can I use the pointer to get the HWND?

Upvotes: 0

Views: 4648

Answers (1)

t.niese
t.niese

Reputation: 40852

GLFW has a section about native access there you can find this function that allows you to retrieve the HWND:

HWND glfwGetWin32Window ( GLFWwindow * window):

Returns
The HWND of the specified window, or NULL if an error occurred.
Thread safety
This function may be called from any thread. Access is not synchronized.
Since
Added in version 3.0.

Please read the documentation carefully:

By using the native access functions you assert that you know what you're doing and how to fix problems caused by using them. If you don't, you shouldn't be using them.
Before the inclusion of glfw3native.h, you may define zero or more window system API macro and zero or more context creation API macros.
The chosen backends must match those the library was compiled for. Failure to do this will cause a link-time error.

Upvotes: 6

Related Questions