_ActiveX Documents and the World Wide Web_ by Vinod Anantharaman Listing One interface IOleDocument : IUnknown { virtual HRESULT CreateView(pipsite,pstm,dwReserved,ppview)=0; virtual HRESULT GetDocMiscStatus(pdwStatus) = 0; virtual HRESULT EnumViews(ppenumview, ppview) = 0; } interface IOleDocumentView : IUnknown { virtual HRESULT SetIn-placeSite(pipsite) = 0; virtual HRESULT GetIn-placeSite(ppipsite) = 0; virtual HRESULT GetDocument(ppunk) = 0; virtual HRESULT SetRect(lprcView) = 0; virtual HRESULT GetRect(lprcView) = 0; virtual HRESULT SetRectComplex(lprcView, lprcHScroll, lprcVScroll, lprcSizeBox) = 0; virtual HRESULT Show(fShow) = 0; virtual HRESULT UIActivate (fUIActivate) = 0; virtual HRESULT Open(void) = 0; virtual HRESULT Close(dwReserved) = 0; virtual HRESULT SaveViewState(pstm) = 0; virtual HRESULT ApplyViewState(pstm); virtual HRESULT Clone(pipsiteClone, ppviewClone) = 0; } Listing Two interface IOleDocumentSite :: public IUnknown { virtual HRESULT ActivateMe(pviewToActivate) = 0; } Listing Three IOleObject::SetClientSite(LPOLECLIENTSITE pclientsite) { //Perform regular SetClientSite processing. if (pclientsite) { // query for document site pointer if (pclientsite->QueryInterface(&IID_IOleDocumentSite,&m_pdocsite)==NOERROR) m_fDocObject = TRUE; } } Listing Four interface IOleCommandTarget : IUnknown { virtual HRESULT QueryStatus (pguidCmdGroup, cCmds, rgCmds[], pcmdtext) = 0; virtual HRESULT Exec (pguidCmdGroup, nCmdID, nCmdexecopt, pvarargIn, pvarargOut) = 0; } Listing Five typedef enum { PRINTFLAG_MAYBOTHERUSER = 1, PRINTFLAG_PROMPTUSER = 2, PRINTFLAG_USERMAYCHANGEPRINTER = 4, PRINTFLAG_RECOMPOSETODEVICE = 8, PRINTFLAG_DONTACTUALLYPRINT = 16, PRINTFLAG_PRINTTOFILE = 64, } PRINTFLAG; typedef struct tagPAGERANGE { LONG nFromPage; LONG nToPage; } PAGERANGE; typedef struct tagPAGESET { ULONG cbStruct; BOOL fOddPages; BOOL fEvenPages; ULONG cPageRange; PAGERANGE rgPageRange[1]; } PAGESET; interface IPrint : IUnknown { HRESULT SetInitialPageNum(LONG nFirstPage); HRESULT GetPageInfo(LONG* nFirstPage, LONG* pcPages); HRESULT Print(DWORD grfFlags, DVTARGETDEVICE** pptd, PAGESET** ppPageSet, STGMEDIUM** ppstgmOptions, IContinueCallback* pCallback, LONG nFirstPage, LONG* pcPagesPrinted, LONG* pnPageLast); }; Listing Six interface IContinueCallback : IUnknown { HRESULT FContinue(void); HRESULT FContinuePrinting(LONG cPagesPrinted, LONG nCurrentPage, LPOLESTR wszPrintStatus); };