PDA

View Full Version : How to get a handle to a GLUT window ?



Andru
07-18-2002, 02:57 AM
Hi,

I'm using GLUT to create a second window from my app.

The question is:

How do I get a handle to the GLUT-created window ? A simple int from GLUT will not suffice, I want to minize/maximize and do other Win API stuff with the window.

I know this is possible... just don't know how.

Thanks in advance,

// Andru

Michael Steinberg
07-18-2002, 08:36 AM
I never used glut, but it's point is to be api(and os) independant. So there's no point in using win32 api calls for a glut window. I am pretty sure that glut provides some calls to tell it how large you want the window to be.

no-one
07-18-2002, 01:10 PM
HWND FindWindow(
LPCTSTR lpClassName, // pointer to class name
LPCTSTR lpWindowName // pointer to window name
);

HWND thewindow = FindWindow(NULL,WindowName);

Andru
07-18-2002, 11:08 PM
Michael:

Yep you are correct. But I want to be able to minimize and maximize and restore the window, and GLUT has no functionality for that.

It seems no-one knows how to get the handle... ;-)

Thanks no-one =)

I'll try that FindWindow() stuff...

// Andru

Rob Fletcher
07-19-2002, 02:43 AM
Hi, I'm not a winblows hacker, but ...

There is a global symbol

__glutCurrentWindow

which you could use to pick up data from the current window structure ...

e.g.
__glutCurrentWindow->hdc

which would be the handle you require, I think!

So, in your program, set up this to make the
symbol available to you ...

extern GLUTwindow *__glutCurrentWindow;

and then pick out the stuff you need from the current window.

If you read the code, you should be able to get info from any window created by GLUT.

Just a matter of getting the right pointer to the window info structure in question!

Hope this helps ... if only a little ...

Rob.