views:

424

answers:

2

I have an ActiveX control that displays documents of a given file format within IE, much like Adobe have an ActiveX control that displays PDFs.

My control is a full-page control, just like the PDF viewer - it takes over the whole client area of IE, using IE's own EnableFullPage mechanism.

I'd like to take control of the various menu and toolbar commands that pertain to the document: Print, Print Preview, Page Setup, Save As, Select All, Copy, Find, and so on. I'm guessing there must be an official API for doing this, because the PDF viewer does it. (Note that the standard mechanisms for eg. printing embedded ActiveX controls don't apply - I need to show my own Print dialog and control the whole process, just like the PDF viewer does.)

(Prior to IE8 I was able to do it by using Win32 subclassing to hack into IE itself, which is nasty but works. But IE8 keeps the tab contents in a different process from the toolbar, so that's not an option without DLL injection, and I can see that the Adobe PDF veiwer isn't doing that. That's why I believe there's an official mechanism.)

+2  A: 

Probably some interface related to DocObjects, maybe IOleInPlaceFrame + IOleCommandTarget

Anders
IOleInPlaceFrame was something I'd been wondering about, but how do I obtain one for the Internet Explorer instance that's hosting my control?
RichieHindle
I have never actually created a ActiveX control, so I have no idea. Assuming you have a IOleClientSite*, try: IOleClientSite.QI(IOleInPlaceSite) then IOleInPlaceSite.GetWindowContext() should give you IOleInPlaceFrame
Anders
+1  A: 

You may use the ActiveDoc sample as a base for implementing an active document server as Anders suggested. Adding IOleCommandTarget, as he also noted, gives you control over the menu items.

roland