PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Getting a device context's parent window

Just a short question:
Does anyone know of a way to get the parent window (HWND) of a device context (HDC)?
It should be like this Windows standard call but only backwards:

hDC = GetDC(hWnd);

I need this for my OpenGL port because GAPI needs a window as a paramter to init the drawing functions and not a device context but the standard Windows OpenGL implentation call wglMakeCurrent needs a device context as a parameter. (I want to make my port as close as possible to the original Windows implentation)
Too bad CE doesn't support WindowFromDC like XP/NT/ME does. That sounds like what you need.
Yeah, that's the one! Damn, why isn't this supported in the Windows CE SDK???
Does anyone know of a another way or a workaround function for my problem?
Thanks a lot for your help!
Could you enumerate all the windows and then check the DC?
That won't work either. You can call GetDC twice on a window and it will return a different value each time. Not to mention there can be device contexts that are not associated with any window.