Using ATL to write a simple COM server

Source: Internet
Author: User

The object of this article is a beginner of COM programming designed to describe how to create a COM server with ATL and how to invoke a COM server in a client application written by VC or VB. In order not to add to the burden for beginners, this article does not intend to delve into the details of COM and IDL, but rather demonstrates the steps required to create a simple COM object with ATL. Hopefully, this article will stimulate your desire to learn COM programming.

First step: Run the ATL COM Wizard (see figure I)

The first thing you have to do is start VC to create a new project. Select ATL COM AppWizard. Note that the project created by this wizard does not contain any initial COM objects, and after completing this wizard, specify the type of object you want to add to this project from the "New ATL Object" command in "ClassView".

In the Project name edit box, name the project: "Simple_atl". Specify the location of the project in the Location edit box, such as "E:\samples\Simple_ATL", and then click the OK button.

(Figure I)

You will see a selection screen (Figure II).

(Figure II)

The first radio button option is the server type that you want to create. Because we want to create an in-Process server (server DLL), the type that should be selected is the dynamic link library "Dynamics link Library--dll", and note that all in-process servers are DLLs. Here are three check boxes and don't worry about it, it has nothing to do with the project we created. Click the Finish button. The wizard will automatically generate the appropriate file. Then the New Project Information window tells you what files The wizard will create (figure III). After confirming, click the OK button.

(Figure III)

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.