ACTIVEX Technology Summary

zhaozj2021-02-11  182

ACTIVEX Technology Summary

Zheng Pei, Xiongzhen

Keywords: ActiveX, Internet, HTML, Web, OLE technology, control, object

This article combines the development trend of the current Internet (Web) technology, brief introduction to the ActiveX technology proposed by Microsoft.

Content, the relationship between ActiveX Technology and Web Site Construction and Desktop Programs, and the use of Visual C and Visual Basic

Develop the steps and methods of the ActiveX component, and give examples of using ActiveX components in a web page.

ActiveX summary

1.1. ActiveX definition

ActiveX is a set of Microsoft's use of COM (Component Object Model, Parts Object Model)

Software components are interacting in a network environment. It doesn't matter with specific programming languages. As a target for the Internet

With development technologies, ActiveX is widely used in various aspects of the web server and client. At the same time, ActiveX technology is also

Used to facilitate creating a normal desktop application.

1.2. ActiveX content

ActiveX includes both server-side technology and client technology. Its main content is:

* ActiveX Control; ActiveX is used to support the web page, Microsoft Word, etc.

Insert a COM object in a container.

* ActiveX Document; used to support ActiveX in Web Browser or other containers

Browse the composite document (non-HTML document), such as Microsoft Word documents, Microsoft Excel documents or users

Defined documentation, etc.

* ActiveX script description; manipulating ActiveX control from the client or server

System and Java programs, pass data, coordinate their operations.

* ActiveX Server Framework; provides a series of Web servers

Use the program to design the functions of each aspect and its package, such as server filters, HTML data stream control, and the like.

* In Internet Explorer, Java Virtual Machine, enabling Java Applet

Ability to run on Internet Explorer and can communicate with the ActiveX control through script description language.

1.3. Comparison of ActiveX and Java

ActiveX provides a mechanism for extending any programming languages, including Java, Java developers can in Applet

Using ActiveX technology, directly embed ActiveX control, or use ActiveX technology as a bridge to mention other developers

The program objects of multiple languages ​​are integrated into Java. ActiveX provides "Code Signature" compared to Java's bytecode technology

(Code Signing) Technology guarantees its security.

1.4. Internet Explorer and Netscape Navigator

It goes without saying that Microsoft's Internet Explorer fully supports ActiveX. At the same time, Microsoft offers

Netscape Navigator's plugin (PLUG-I), making Navigator can also browse the Web site containing the ActiveX part.

2. ActiveX Control and Internet

ActiveX Control is an update version of OLE control. Control is a programmable component (Component)

The main element. ActiveX Control can be used in a container that supports COM specification, or is embedded as an Internet.

On the page. When the user accesses the page, the control is downloaded and automatically registered locally. Using Script Description Language (script)

In terms of control and between the client and the server, the Call method (Method) and the activation event

Part (Event) for communication.

ActiveX control has fewer interfaces compared to previous OLE control, and there is no window. All ActiveX

Control supports the iUnknown interface.

At present, many third-party developers have developed a wide range of ActiveX controls. On the Internet, there are more than 1000

ActiveX Control is available for users to download. In the system directory of Windows, save ActiveX control provided by WINDOW

system. Microsoft Visual C (hereinafter referred to as VC) is provided with the MFC (Microsoft Foundation Classes) control

All is ActiveX control.

Considering the current Internet's relatively low transmission rate, the design running on the Internet-based ActiveX control must

Consider the following questions:

* The control is as small as possible;

* How to save data (persist data);

* How to download and install on the Internet;

* Control how to register on the client;

3. ActiveX documentation and Internet

ActiveX documents provide a traditional embedded object extension method. ActiveX document objects can contain multiple pages, show

Show in the entire client area and supports the original menu function. Unlike previous embedded objects, ActiveX document objects are no longer

Surrounded by a shaded frame, but a full frame and is always active.

Microsoft Office97 provides Microsoft Office Binder for generating and browsing by Microsoft Word.

, Microsoft Excel or user-defined ActiveX document, etc. Composite document, each document type can

Direct editing modification.

ActiveX documents can be embedded as an object into a web page, published on the web.

4. ActiveX script description language

With VBScript or Microsoft JScript, you can add ActiveX control that can be used to interact to the web page.

Place the data pretreatment or verification process in the client, then pass the result to the web server.

5. ActiveX Server Framework

Create an extended application on the web server, dynamically generate a web page. The ISAPI class provided with MFC can be convenient

Establish an extended application of the web server side.

6. Visual C 5.0 support for ActiveX

VC 5.0 (Enterprise Edition) provides a complete solution for Internet development, and its content is:

* Develop ActiveX control and ACTIVEX documents using MFC or ATL.

* Use the ISAPI to design the part of the web server side.

* Develop applications that use Wininet to access files over the Internet.

* Use Asynchronous Monikers to generate applications that download data from Internet.

* Develop other types of Internet-based Win32 applications using ActiveX SDK, including ActiveX Scripting Host

Microsoft WebConferencing, etc.

6.1. Develop ActiveX Control with VC5.0

VC 5.0 provides two ways to develop ActiveX control: MFC and ATL (Active Template Library). use

MFC, you can't pay attention to the details of the interface, focusing on the function of control itself, but the generated control is compared

Big. Moreover, if the client is to run this ActiveX control, you must have the corresponding version of the MFC class library DLL, otherwise, must

Simultaneously download these huge libraries; use ATL, due to not involving the standard class library of MFC, the generated control is relatively small, but open

The sender must understand the details of COM, OLE technology. In most cases, MFC can be used to develop ActiveX control, so comparison

easy.

Moreover, since Internet Explorer 3.0 provides the library of MFC 4.1, Internet Explorer 3.0 is Windows95

The components provided are provided, so as long as ActiveX control is used by MFC 4.1 or earlier, there is no need in most cases

To download the MFC class library.

Using MFC development ActiveX control, you can generate engineering frameworks with MFC ActiveX Control Wizard. VC will be self

Three categories: (assuming myName is the name of the control.)

* CMYNAMEAPP: Delate from class ColecontrolModule, and class ColeControlModule is sent from CWINAPP;

* CMYNAMECTRL: Deleted from class Colecontrol, and class ColeControl sent from CWND;

* CMYNAMEPROPPAGE: Deleted from class ColePropertyPage, and class ColeProppage is sent from CDIALOG;

It can be seen that this framework is similar to a general MFC application. Most of the developer working in CMYNAMECTRL

In, for example, use Class Wizard to add attributes, methods, and events, processing display, etc.

After compiling the generated OCX file, use the ActiveX Test Container provided by VC to test this control, or

OLE / COM Object Viewer Browse this control interface information and type library.

6.2. Application of ActiveX Controls on the Web

Considering the security of the Web, in order to establish a good trust relationship with the client, you must be on the web.

Set a "code sign" with ActiveX control. VC5.0 provides "code for generating" code

Signature "tool. If you want to be officially released, you must apply to the relevant agency. (See http://www.microsoft.com/

INTDEV / SIGNCODE /)

Use ActiveX control in the web page, and pack it, press the relevant dynamic connection library and information files.

Return to an extension in the CAB (Cabinet) file. You can package ActiveX control using the tool package provided by VC5.0. In html

In the file, use the Object tag into ActiveX control and use VBScript or JScript to access the ActiveX control. When the client browsing this page with Internet Explorer, you can automatically unpack this file. For security considerations, Internet

Explorer is the download, initialization of the ActiveX component, whether it has legal code signatures and whether scripting is allowed

Wait a different level of security, the user can set as needed. In this example, ActiveX control is used.

"Mschart.ocx", when you click this control with a mouse, the title of the control will change.

ClassID = "CLSID: 31291E80-728C-11CF-93D5-0020AF99504A"

Codebase = "mschart.cab # version = 1, 0, 0, 0"

ID = chart1

Width = 400

HEIGHT = 200

Align = center

>