Get HWND of GLFW window under Windows?

nobody wrote on Sunday, May 27, 2007:

How can you get the HWND of an openGL window created with GLFW?

elmindreda wrote on Sunday, May 27, 2007:

You can’t. Why do you want to?

nobody wrote on Sunday, May 27, 2007:

To change the icon of the window. I’ve already seen some threads regarding this, but they involved editing and recompiling GLFW, which I don’t really want to do.

elmindreda wrote on Sunday, May 27, 2007:

Ah, well it just so happens I have a patch here that solves this. I’ll merge it and it’ll be in the next release of 2.6.

What this lets you do is add an icon resource named GLFW_ICON to your application, and GLFW will set it as the window icon. No GLFW changes required.

In the meantime, you may be able to get hold of the window handle with the GetActiveWindow() call, but note that this requires windows.h and won’t be portable.

nobody wrote on Sunday, May 27, 2007:

Aha, good. I suppose I can live without an icon for the time being :).