Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
SSW_8_11.doc
Скачиваний:
0
Добавлен:
01.05.2025
Размер:
5.22 Mб
Скачать

13.4 ActiveX

ActiveX is a set of technologies that uses the Component Object Model (COM) to enable software components to interact with one another in a networked environment, regardless of the language in which they were created. ActiveX technologies can be used to create applications to run on the desktop or the Internet.

ActiveX includes both client and server technologies, including the following:

  • ActiveX Controls are interactive objects which can be used in containers such as a Web site.

  • ActiveX Documents enable users to view documents, such as Microsoft Excel or Word files, in the entire client area of a Web browser or other ActiveX container.

  • Active Scripting controls the integrated behavior of several ActiveX controls and/or Java programs from a browser or server.

MFC versions 4.2 and later supply ActiveX documents to components such as the Microsoft Office Binder and Microsoft Internet Explorer 3.0. The Office Binder and Internet Explorer act as OLE clients, while the documents, called document objects or ActiveX documents, are provided by ActiveX document servers. At present, MFC does not provide built-in support for ActiveX document containers, but it does fully support ActiveX document servers. You can still program ActiveX document containers yourself.

MFC implements ActiveX document servers with document object view interfaces, document interfaces, command dispatch maps, printing, menu management, and registry management.

MFC supports ActiveX documents with the CDocObjectServer class, derived from CCmdTarget, and CDocObjectServerItem, derived from COleServerItem.

CDocObjectServer maps the ActiveX document interfaces and initializes and activates an ActiveX document. MFC also provides macros to handle command routing in ActiveX documents. To use ActiveX documents in your application, include AFXDOCOB.H in your STDAFX.H file.

A regular MFC server hooks up its own COleServerItem-derived class. MFC AppWizard generates this class for you if you select the Mini-server or Full-server check box to give your application server compound document support. If you also select the ActiveX Document Server check box, AppWizard will generate a class derived from CDocObjectServerItem instead.

ActiveX Document Servers

Unlike an OLE embedded object that is displayed within the page of the document that owns it, an ActiveX document is a full-scale, conventional document that is hosted by another application acting as a container (Microsoft Office Binder, browsers, and so on). Unlike embedded objects, ActiveX documents have complete control over their pages and can exploit the complete native functionality of the server (application) that creates them. Users can create documents using the full power of their favorite applications (if they are ActiveX document enabled), yet can treat the resulting project as a single entity.

ActiveX documents can have more than one page and are always in-place active. ActiveX documents control part of the user interface, merging their menus with the File and Help menus of the container. They occupy the entire editing area of the container and control the views and the layout of the printer page (margins, footers, and so on).

An ActiveX document must support the standard COM interfaces IPersistStorage, IOleObject, IDataObject, IOleInPlaceObject, and IOleInPlaceActiveObject. It must also implement the ActiveX document interfaces IOleDocument and IOleDocumentView. IOleDocument has much of the functionality of the CDocument class, while IOleDocumentView has the functionality of CView. Optionally, the ActiveX document can implement interfaces specific to ActiveX documents, including IOleDocumentCommandTarget and IPrint.

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]