MFC and ActiveX HWND

Hey guys I got a pretty unique situation here and I was wondering if somebody could enlighten me.

I have a full-fledged application contained in a dialog-based MFC program using html dialogs. The UI is basically written completely in HTML (CDHtmlDialog) and it connects seamlessly (both ways) to the main MFC app. I started with the MFC Application Wizard in Visual Studio and changed the application type to HTML dialog-based. I know it's kind of a crazy idea building the UI in HTML but I thought it was pretty cool. It even has native win32 api menus and status bars.

What I'm trying to do is get a DirectX device to render to an element INSIDE the HTML page. All I really need is a hwnd (window handle) to the HTML element.

Of course, I know that MSHTML renders controls in a "windowless" fashion but I also that some ActiveX control can actually have their own windows (something about m_bWindowOnly.) For example, the following object rendered in a 32-bit MSHTML app will produce a slider with it's own window.

<object classid="clsid:F08DF954-8592-11D1-B16A-00C0F0283628" width="100" height="100" id="Slider1">

I know because in Spy++, under your app, within the "Internet Explorer_Server" window, there's another window with a class "Slider20WndClass".

So my question is: How do I get the window handle to that ActiveX control?
Its possible the documentation for the ActiveX Control you are running might give you some insight on this. The Api function EnumChildWindows() is an enumerator, and will return all HWNDs of a parent. Also, with a HWND you can get the address of the Window Procedure for its class, whatever that might be. Just throwing some ideas out there for you to mull over and research.

I wrote an ActiveX Grid Control recently - all low level COM, no ATL, and one of the methods of the main interface was to return the HWND of the 'container' window of the grid. So what I'm saying is that attempting to get or even needing the HWND of an object like that isn't that unusual. The main issue would be whether the original designer of the object felt making the HWND available would break encapsulation or not.
Thanks man, I can't believe I didn't think about EnumChildWindows()
Topic archived. No new replies allowed.