+ 2
How can you get a Window handle (HWND) corresponding with a window's resource id?
I'm using OpenGL utility toolkit(GLUT) which gives an int to identify a window. I think the int is the resource identifier when GLUT is used in Microsoft Windows. I want to get an HWND for a screenshot. I can get the foreground window's HWND using GetForegroundWindow but I'd like to get the corresponding HWND even if it isn't in the foreground.
2 Respostas
+ 1
You may have to find the window by its title bar. I remember having to do that once by using a Windows API that returned a list of all open windows and searching by title to get its corresponding HWND in the structure. So I also had to make sure the title was uniquely identifiable. That was the best solution nearly a decade ago. Maybe it still applies.
+ 1
Brian, you're probably right that hoping for a unique window title is the best I can do. It is unfortunate that GLUT can't give something more reliable or clean but maybe that's part of the price of GLUT being so OS-independent.