multiple windows with MFC?

I have searched through these boards and have not yet found the answer to my problem…

Currently I have an application with a mainwindow and a dialog bar down the side. The main window supports opengl. I want to be able to add a small opengl window to the dialog bar but have not yet achieved success. Does anyone know of any sample code that shows something similar. I am not using the doc-view architecture.

Do I have to use an RC that was created in my mainwindow class in the dialog bar class, or can I create a new RC in the dialog bar class and use it as well.(with the appropriate calls to wglMakeCurrent)

Well, each window must have it’s own RC. Period. So create a new one and use wglMakeCurrent.

I think that’s all you really wanted to know?


Thanks for the info.
I was finally able to create and render to these 2 different windows. Now, I am having a problem with resizing. If I resize (ie hit the min/max buttons) The main window is fine, but the new smaller window doesnt seem to be getting the WM_SIZE message. Any more hints?

Well, my suggestion is that in the parent window (the frame window), you explicitly SendMessage WM_SIZE with the proper parameters to each child window.


I had tried to send a WM_SIZE message. In my previous post, I forgot to mention that the problem I am having is that when I resize the window, the smaller window does not redraw the scene. It does color the background, but the scene is not there.

I thought it might have been because OnSize() was not being called, but I explicitly sent this message and still had no success. In fact,now when I send the message in the Parent’s OnSize(), it does not even draw the scene the first time.

Welcome to MFC hell Read up on message passing in msdn mfc section. This is the reason I dumped MFC and went with win32 and I thank the lucky stars for having a sence to do this early on. Resizing is a piece of cake in win32, send a message to status bar and toolbar and you’re done. Very transparent and not shrouded in gazillion message passings or deeply rooted in corner of mfc source code Splitter bars are also evil.

Go to and check out 3d editor screen shot page. Not as nice looking as mfc but functional and coded very quickly.