COM Application Software Development technology

Source: Internet
Author: User
Tags object model thread

1.COM Technology Overview

COM represents the Component Object model, the software development technology that Microsoft promotes. The application software developed by COM specification has the powerful function, mainly has the following several points:

COM is a binary programming specification that allows you to write code that is used in multiple languages.

Used to create an ActiveX control.

Control other programs through OLE Automation.

Dialogue with objects or programs on other machines to form a distributed application.

After Microsoft launches Windows 98 and Windows NT 5.0, the core of the entire operating system is built around COM. We can view the Windows system as a series of COM interfaces that can be invoked when needed. Such as DirectX is a series of COM interface service programs, through which you can perform high-performance Windows graphics programming.

Applications developed using COM technology are theoretically client/server-mode programs. Programmers can use a series of COM service programs to construct their own applications, which can be embedded in the main program at any time as needed. In distributed systems, these service programs can be accessed over the network. In the future, the operating system and the entire network may be viewed as a set of services provided in the form of COM objects. Some programmers are responsible for building these services, while the other part of the programmer is only responsible for calling them. The purpose is to realize the Plug and Play of the software.

Developing COM applications is more complex and typically requires the use of ActiveX template Libraries (ATL) for programming. Here we recommend the use of C + + Builder to develop COM programs, Inprise (Borland) Company's object-oriented technology has been at the world's leading level, C + + Builder using visual methods, hiding the implementation details of ATL, the code needed to automatically generate COM interface.

The following procedures for example using C + + Builder 4.0, in the Chinese Windows98 environment run.

2. Establish COM Service Program

COM Service programs have three different forms, the first is to reside on the local machine, provided as a DLL, when invoked, to be embedded in the calling program's thread, and the second to reside on the local machine provided as an EXE, which will occupy a separate thread when invoked The third resides on the remote machine and is provided as an EXE, and the service program is invoked over the network, which runs on the remote machine and returns the caller over the network.

In this form, the first form of COM service is established, which is the most commonly used form, which is provided by DirectX.

C + + Builder The following methods for establishing COM service programs:

2.1 Create a dynamic connection library file that supports COM interface objects:

Open the File/new/activex project page and select the ActiveX Library;

Select Save All to save the item as a pcomserver file name, at which point the C + + Builder automatically generates the following file:

PCOMSERVER.BPR: project documentation for the project;

Pcomserver.h,pcomserver.cpp: A dynamic Connection library source file that supports COM objects, many of which are used for automatic assembly of COM interface objects, and we don't have to edit them;

Pcomserver_atl.h,pcomserver_atl.cpp:atl form of files for C + + Builder compiler calls, you do not edit them.

Open the Project/options/linker property page without selecting the Use dynamic RTL option, open the Project/options/packages property page without selecting the Builder with runtime packages option, These two steps enable the developed COM dynamic Connection library to be independent of the C + + Builder VCL Dynamic Connection library, but it is generally recommended that you select both.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.