OpenGl in Dialog

I use OpenGL in MFC.
Here I want to draw second OpenGL window in a opened dialog. How to do it?
Anyone has examples?

It’s quite easy. Instead of using the dialog window itself as your DC, create a Picture Control and use it’s DC (which you can find using GetDlgItem). This way you only render to a portion of the screen. Create a second Picture Control and do the same thing…call wglMakeCurrent to switch to the current context before doing any rendering.

Is there any example code?

and now I setup the dialog for drawing.
However, the openGL setting in the dialog will effect opengl in the main window.
How to totally seperate them?

each rendering context has its own state

There are a code:

,I write it for asking how the share texture in defferent opengl context.But i have a bad new:This is can not!