Using vc++6.0 to make ASP server controls introduction (ZT)

Source: Internet
Author: User
Introduction to making ASP server controls using vc++6.0
Rich Bright
--------------------------------------------------------------------------------

Use ASP to write Web page programmer, must vbsript statement "Set conn=server.object" (' ADODB. Connection ') "is very familiar. The statement uses ASP's server object to create a database control that provides a range of methods and properties that can help us implement database operations conveniently in the ASP. Similarly, in visual InteDev6.0, we can also see some of the ASP's built-in components such as "Scripting.FileSystemObject". However, in some cases, the use of these is not enough or complex, and the ASP's script language is far less powerful than the C + + language (such as the establishment of a linked list, B + tree structure, etc.), which makes us think that we can use a good data structure of the C + + language in the Although CGI,ISAPI can be used as a pioneer in the development of the Web page, but we know that the development cycle of CGI,ISAPI is very long, and not with the Web page, poor visibility, writing, debugging difficulties; In terms of stability, because ISAPI is the way of dynamic linking, so in the event of a problem in execution, will cause the Web server to be paralyzed together. And the ASP just can make up these shortcomings.
This shows that if you can learn to write ASP components can be combined with the strengths of the ASP to write a powerful web page. Unfortunately, the author in the market rarely see a special talk about how to use VC + + to make ASP components of the book. General VC Books only talk about some writing Windows Windows program or plus write ordinary dynamic link library. and ASP books is only talk about ASP built-in components of the use of methods. In fact, if you want to really master the mechanism of writing ASP components, it involves a lot of knowledge of COM technology. And some of the books on COM technology are very esoteric and rarely combine useful examples. To this end, I would like to take this article in the simplest way to introduce the process of writing. The so-called introduction, is the description will not involve the specific details of COM knowledge, only give the implementation method.
I. Establishment of the project
Open vc++6.0, select the Alt COM AppWizard in new projects, and enter a good project name (such as MyStudio), remembering that the project name is part of the ASP component name (which can actually be modified, but cumbersome), and select Server Type on the next page As a DLL, and consider a tick before support MFC (presumably with many people who are programming with MFC). Finish by finish. There are four standard export functions registered DLLs in the generated code, and we don't have to care.

Ii. Creating COM objects (new ATL Active Template Library classes)
Select Insert New class on the menu, and create a new ATL class, such as Cmycomponent, you will find a imycomponent in the interface table, and the methods and properties for creating the interface can be used in ASP. Remove the aggregatable option, we don't need it. Keep the rest unchanged.

Third, add interface method
In ClassView, right-click Imycomponent, and in the menu that appears, press Add method. As shown in the figure, method name can be written as Initmycomp. The parameters of the method are written in parameters such as [In]int number1,[out,retbal]int* Number2. What we want to specify here is the wording of the parameter.
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.