ACTIVEDOC: Demonstrates How to Implement an ActiveX Document Server

Click to open or copy the ACTIVEDOC project files.

This sample demonstrates how to implement an ActiveX Document Server. The program demonstrates the following:

Running the Sample

Build the project, then start Microsoft Office Binder. On the Section menu click Add. An icon labeled ActiveDoc Class appears. Select this icon and click OK. You should see the object embedded in Office Binder. Notice that the menus have been merged and the ActiveDoc object's toolbar is shown. You can enter text and use the menu and toolbar buttons to change the color of the text that is typed.

The sample contains the following main files:

This sample uses the following keywords:

ActiveXDocActivate; ALT_MSG_MAP; ATLASSERT; ATLTRACE; BEGIN_COM_MAP; BEGIN_MSG_MAP; BEGIN_OBJECT_MAP; BEGIN_PROPERTY_MAP; BEGIN_TOOLBAR_MAP; CAboutDlg::DoModal; CanInPlaceActivate; CComCoClass; CComControl; CComModule::GetClassObject; CComModule::GetLockCount; CComModule::Init; CComModule::RegisterServer; CComModule::Term; CComModule::UnregisterServer; CComObjectRoot; CComObjectRootEx::InternalQueryInterface; CComPtr; CHARFORMAT; CMenu; COM_INTERFACE_ENTRY; COM_INTERFACE_ENTRY_IMPL; COMMAND_ID_HANDLER; COMMAND_RANGE_HANDLER; CreateMenu; CreateRTFWindow; CreateToolbar; CreateWindowEx; CToolbar; CWindow::DestroyWindow; CWindow::ModifyStyle; CWindow::SetFocus; CWindow::SetParent; CWindow::SetWindowPos; DECLARE_REGISTRY_RESOURCEID; DestroyMenu; DestroyToolbar; DisableThreadLibraryCalls; DllMain; DoesVerbUIActivate; EDITSTREAM::dwCookie; EDITSTREAM::dwError; EDITSTREAM::pfnCallback; Ellipse; END_COM_MAP; END_MSG_MAP; END_OBJECT_MAP; END_PROPERTY_MAP; END_TOOLBAR_MAP; EndDialog; ExtTextOut; FreeLibrary; GetMenuItemCount; GetMenuItemID; GetMenuState; GetMenuString; GetResourceInstance; GetStockObject; GetSubMenu; GetTextMetrics; GetWindow; GetWindowContext; GetWindowRect; HDC; hdcDraw;; IDataObjectImpl; IDispatchImpl; InitCommonControls; InlineIsEqualGUID; InPlaceDeactivate; InPlaceMenuCreate; InPlaceMenuDestroy; InsertMenu; InterfaceSupportsErrorInfo; InternalQueryInterface; IOleControlImpl; IOleDocument::GetDocMiscStatus; IOleDocumentImpl; IOleDocumentView::ApplyViewState; IOleDocumentView::SetInPlaceSite; IOleDocumentViewImpl; IOleInPlaceActiveObjectImpl; IOleInPlaceFrame*   pFrame;; IOleInPlaceFrame::InsertMenus; IOleInPlaceFrame::Release; IOleInPlaceFrame::SetMenu; IOleInPlaceObjectWindowlessImpl; IOLEInPlaceSite::GetWindowContext; IOleObjectImpl; IPersistStorageImpl; IPersistStreamInitImpl; IProvideClassInfo2Impl; IQuickActivateImpl; ISupportErrorImpl; IViewObjectExImpl; LoadLibrary; LoadMenu; LoadString; MAKEINTRESOURCE; MergeMenus; MESSAGE_HANDLER; NOTIFY_CODE_HANDLER; OBJECT_ENTRY; OleCreateMenuDescriptor; OLEINPLACEFRAMEINFO; OnInPlaceActivate; OnUIActivate; prcBounds; RECT rcPos, rcClip;; RemoveMenu; SelectObject; SendMessage; SetActiveObject; SetBkMode; SetBorderSpace; SetControlFocus; SetFocus; SetInPlaceSite; SetMenu; SetObjectRects; SetTextColor; ShowObject; ShowWindow; UIActivate; UIDeactivate; UnmergeMenus; ZeroMemory