[ContextHandle] In Place of Deprecated 'Handle' ?


Trying to get the hWnd (on Windows) of an OpenGLSurface using Me.Handle I get this warning:
“Handle is deprecated. You should use ContextHandle instead”

There is currently no mention of ‘ContextHandle’ in the documentation however there is two times ‘Handle’. Should I presume ContextHandle is in fact one of those two and is:
“This is the OpenGL context identifier.”, what we usually call hDC ?

And ‘Handle’ returns the hWnd as usual, although I’m not sure why it would be deprecated in this case ?


Actualy I guess ContextHandle returns hGLRC, not hDC.

OpenGLSurface’s Handle property was deprecated because it was shadowing RectControl’s Handle property, which lead to some nastiness:

Dim surface As OpenGLSurface = ... Dim h1 As Integer = surface.Handle // this is an HGLRC Dim h2 As Integer = RectControl(surface).Handle // this is an HWND

ContextHandle was introduced to make it somewhat better and hopefully lead to eventually being able to remove OpenGLSurface’s old Handle property.

That clears things up.

Thanks Joe.