Render OpenGL in any Window with a Windowhandle ( hWnd)

Hello
How can I render the result of an OpenGL
C-program in any Windows2000 Window, if
I have the hWnd from
FindWindowA(lpszClassName,lpszWindowName);
or the WindowsRefnum.

Thank You, very much!

Now that seems fun.

Screensavers support some such (on the commandline!), but they don’t draw into the window, they open an own window on top of the client area of the desired window and have to hook some WM_WINDOWPOSCHANGED messages.

The question is if you’re able to do SetPixelformat() and if the window has the correct styles (CLIPCHILDREN and CLIPSIBLINGS).

It will probably work, if you want to replace the drawing in the “parent” window. Mixing is rather impossible.

Take a look at what you can do with hooks.
You’ll have to add something to the WM_CREATE, WM_DESTROY, WM_PAINT, WM_ERASEBACKGRND, WM_WINDOWPOSCHANGED event handlers before or after the handlers in the program.

I would go for the additional window.

PS: Forget about the WM_CREATE, it’s already too late.

[This message has been edited by Relic (edited 02-01-2001).]