'Fixing' the device context

I am trying to get OpenGL working as a plugin in internet explorer.
In a draw callback I get a device context and dimensions of the html element.
I have no control over the creation of this device context.
(it is the IHTMLPainter::Draw() callback).
Now on this device I can call ChoosePixelFormat(), SetPixelFormat() and wglCreateContext() with no error.
But calling wglMakeCurrent() on this dc with the newly created open gl context results in error 2005 : The requested clipping operation is not supported.

The OpenGL code works in an example where I create the window myself. So the difference is in the properties of the device context or window.
You cannot change this once the dc is created I guess, but does someone have any ideas about how to work around this ?




I guess the solution is to render to a bitmap and copy the buffer to the update region.
See technical articles about OpenGL on MSDN :
(Win32 and COM Development, Technical Articles, Graphics and Multimedia, Open GL)


I have created IE7 activex plugin for our website (www.centroidonline.com and browse library).

To do that, create activex control using visualstudio and override OnCreate. Also, you have to set flag that explains to ax host that this control is not windowless. I dont have code with me now, but I can give you some hints tomorrow.

OK. Here is more info…
in c-tor of your COM object add following:

	m_bWindowOnly = true;
	m_bWndLess = false;

In OnCreate add OpenGL initialisation code.
Override OnEraseBckgrnd and

LRESULT MyCOMObj::OnEraseBckgrnd( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled )
	bHandled = TRUE;
	return 0;