Drawing into a control in a dialog under XP...

I’m making a small test app for some geometric wide line drawing routines that I’ve made. One thing I want to do is have an interactive color editing dialog box that shows the color in a small rectangle within the dialog. Since I’m using alpha values, I want to use OpenGL to render this box.

I’m using straight C and WinAPI, no funny stuff. I can set a context to a control during the WM_INITDIALOG message, but after that, nothing works. The control displays the global color when the dialog box opens, but there is no interaction after that point. Messing with the controls (sliders and edit boxes) allows me to change the global color, I just cannot see it in the dialog.

I’ve racked by brain on this for hours. Anyone have an example of how to do this quickly and easily? I have done a search, but most of what I’ve turned up was C++ or MFC and I’m still trying to grasp C++. Too obfuscated for my tastes. Anyway, I cannot decipher what little I’ve found to get anything working.

Thanks in advance,
Mark

Do you have GL setup on some other window as well?
You can have 1 GL context current per thread. If you have 2 contexts, then you need to call wglMakeCurrent(hdc, glrc) and wglMakeCurrent(NULL, NULL) at the right moments.

Yes, GL is set up in the main window as well. So, when do I call wglMakeCurrent(NULL, NULL)? As I’m setting up the dialog or at some other point?

http://www.opengl.org/wiki/index.php/Platform_specifics:_Windows#Multiple_Windows