This digest from: http://www.job168.com/info/read_100394.html
Many of Microsoft's technologies, such as OLE, ActiveX, and DirectX, are built on COM technology. Microsoft itself also uses a lot of COM components to customize their applications and operating systems. So, what is COM?
The so-called COM, the Component Object model, is a specification that describes how to build dynamic, interactive components that provide some binary and network standards that customers and components should follow to ensure interoperability. This standard will allow communication between any two components regardless of whether the operating environment they are in is the same, whether the development language used is consistent, and whether it is running on the same computer. The purpose of developing COM is to make applications easier to customize and more flexible.
In fact, COM does not appear as part of a separate development process. Instead, it originated in Windows 3.0 in the form of objects and embedded systems. We know that OLE 1 allows an application, such as Word or Excel, to display data from other applications without having to open a second application. However, there are two limitations to OLE 1:
• First, embedded data cannot be edited by the application;
• Second, there is no standardized system for storing embedded information.
As a result, Ole 2,ole 2 was introduced with Windows 3.1, which is the first real COM technology, and OLE 1 does not have the features of COM-it uses another technology system. A new unique data format, called a compound file, is produced in OLE 2. This file can include information about all OLE-supported applications, and supports editing, updating, printing, and more in any application that works.
However, Ole 2 still has some limitations, most notably the need to reopen a window whenever an embedded data is to be edited. Improvements to this point have generated a new version of OLE, called OLE Automation. In addition to allowing editing within the application that invokes the data (called internal editing), the technology adds two other improvements related to COM technology on the basis of OLE 2, providing the ability of non-C + + development programs (such as VB programs) to access COM functions; The second is to support the creation of COM technology-based components that exist outside of the compound file. Windows 3.11 fully supports automation technology.
While this last technical improvement has brought the most lasting impact to COM, the OLE implementation of COM is still not fulfilling the dream of Mr Bill Gate's component software. Another technological innovation that comes with it is-vbx the control to reality through a mechanism that has never been imagined. VBX is a visual baisc development environment of some of the internal tools, the first developed by C + +, but then all are developed with VB. VBX is a class of DLL applications with special support to be used in VB systems. Within a year or so, the VBX control market rapidly developed into a millions of-dollar industry, and led the sales of VB products. The VBX has two important properties that the previous Automation server does not have: the user interface and its ability to communicate with the customer (container).
This unexpected success of VBX has made Microsoft decide to let COM workgroups add performance equivalent to VBX on an automated basis. The result of this development process is the OCX control (a special Automation DLL server) that uses COM technology to support all the features of the VBX control, and it is upgraded to a 32-bit control from this point. Unfortunately, the advent of the Internet and Java has enabled them to be re-engineered into ActiveX controls before the OCX could be popularized.
At the time, no one expected that Java and the Internet would explode in the computer field with the power of a hydrogen bomb in the WWW field. Microsoft has long argued that their monopoly in PC software is a challenge, but Java and web browsers, along with the Internet, are in a whole new way into the field of personal computer software, which is controlled by Sun and Netscape and not by Microsoft. As a part of this, COM became ActiveX, the compound file became an ActiveX file, the OCX control became an ActiveX control, and so on. COM-based ActiveX components are based on the characteristics of the Internet to increase the corresponding new features, such as confidential security performance, short code, data support asynchronous download. At the same time, the ActiveX component also has the following features:
· ActiveX adds a user interface to the Automation server;
• The Common Properties and property page mechanisms standardize the behavior of ActiveX controls;
• The connection point mechanism supports sending events from ActiveX controls to containers;
· The persistence of ActiveX solves the problem of state storage at a more time.
In summary, OLE1, OLE2, OLE Automation, VBX controls, OCX controls, ActiveX, and COM + are all implementations of COM concepts in the Windows operating system. Today, COM has become a core component of the Microsoft product line:
· Internet Explorer 4 Web browser supports all ActiveX controls, in fact it uses an ActiveX component for its display interface;
· Windows 98, a new version of the Windows operating system, binds IE to the operating system, which is based on COM technology and supports active desktops, enabling the desktop parts to function as network applications;
· Internet Information Server (IIS) is a heavyweight weapon for Microsoft to join the Web servers war, and IIS includes many powerful COM-based content, such as active Server PAGE,ISAPI extensions and ISAPI filters;
• Microsoft Transaction Server (MTS) is a database-oriented system that uses COM technology to support mixed transaction processing of multiple database systems and vending machines, and mimics the way non-databases are executed, turning transaction processing into a single-step behavior with results that can be "successful", "failed", and "returned" Without losing data because of processing failure;
· OLE DB pushes back to COM's OLE 2 technology, which uses the same techniques as ODBC databases to support non-database applications working with database-oriented technologies such as MTS.
On the other hand, at first, Windows is using DLLs to implement code sharing at the binary level. This is also the key to the operation of Windows programs-reuse Kernel32.dll,user32.dll and so on. But DLLs are written for the C interface, and they can only be used by C or the language that understands the C call specification. The programming language is responsible for implementing shared code, not by the DLL itself. In this case, the use of DLLs is limited. Although later, MFC introduced another MFC extension DLL binary sharing mechanism, but its use is still limited-can only be used in the MFC program.
COM solves these problems by defining a binary standard, which means that COM explicitly states that binary modules (DLLs and EXE) must be compiled to match the specified structure. This standard also specifies exactly how COM objects are organized in memory. COM-defined binary standards must also be independent of any programming language, such as named adornments in C + +. In fact, COM is fully leveraging the flexibility of the Win32 DLL to be truly implemented on the Windows platform. COM is published in the form of executable code that is published in the form of a Win32 dynamic-link library (DLL) or executable file (EXE).
Note that COM itself also implements a API called a COM library that provides a range of services, such as client-to-component queries, and registration/anti-registration of components. In general, COM libraries are implemented by the operating system, and programmers do not have to care about their implementation details.
"Note" DirectX Technology
To be on the Windows platformGame Developmentmust be aware of two heavyweight games Api:directx and OpenGL. Among them, DirectX is a Microsoft-developed dedicated to optimizingGame Maker's API. DirectX consists of a number of components: DirectDraw, DirectSound, DirectMusic, DirectPlay, Direct3D, DirectInput, DirectSetup. It is software that allows you to directly control your computer's hardware devices, which are several times faster than Windows GDI and can be used in different languages and platforms, from drawing pixels to advanced 3D images, from playing simple sounds to digital music, from keyboard controls to anti-shock handles ... Almost for you.Game DevelopmentProvides everything you need. Note that the basis of DirectX is COM technology.
What is COM +?
It must be clear that COM + is not a simple upgrade of COM, but its underlying structure is still based on COM, COM + integrated with COM, DCOM and MTS technical elements, the COM component software to the application layer and no longer the underlying software structure, it through the various support of the operating system, The Component Object model is built on the application layer, leaving the underlying details of all components to the operating system, so that COM + works more closely with the operating system. 3 shows the relationship between COM + and MTS, com/dcom.
Graph 3.com+ and the relationship between MTS and com/dcom
On the other hand, COM + is no longer confined to COM's component technology, it is more focused on the design and implementation of distributed network applications. COM + inherits almost all of the advantages of COM, while avoiding some deficiencies in COM implementations, combining the programming models of COM, DCOM and MTS organically, inheriting most of their features and adding new features to the original features:
• True asynchronous communication.
• Event services.
• Manageable and configurable.
• Easy to develop.
COM + marks a new level of Microsoft's component technology, which is no longer confined to a desktop system on a single machine, but rather targets a broader intranet, or even an international interconnection network. COM + and Multilayer architecture models (Windows DNA architecture, see the next section) and the Windows operating system provide a complete set of solutions for enterprise applications or Web applications.
"Problem". NET era, will COM disappear?
No. In fact. NET is just an alias for COM. For a seasoned C + + programmer, the. NET is the evolution of COM, and within Microsoft. NET can be said to be "COM 3.0". In fact, the CLR is a no-compromise COM object. However, please note that. NET uses a different approach to writing components, so. NET component differs significantly from the original COM component: NET components do not need to use the registry and type libraries, because all information about the component is included in the Assembly (Assembly) as metadata. However, with a tool called COM Interop, COM objects and. NET objects can work well together: by providing a package class. NET objects can access COM objects, and COM objects can access. NET objects by providing all registry keys and COM object building mechanisms.
20 years of Microsoft software Development Technology Review-com, OLE, ActiveX, and COM + articles