Microsoft HomeproductssearchsupportshopWrite Us   Microsoft Home
Magazine
 |  Community
 |  Workshop
 |  Tools & Samples
 |  Training
 |  Site Info

Workshop  |  Component Development

So Happy Together? Using ActiveX Components with Active Server Pages


Nancy Winnick Cluts
Developer Technology Engineer
Microsoft Corporation

November 19, 1997

The following article was originally published in the Site Builder Network Magazine.

After writing several articles about Active Server Pages (ASP) technology, I've heard from lots of people who are clamoring for more information. One of the most-requested subjects is the use of ActiveX™ components from ASP. Where can you find information about available components? What tools help you build components? Where can you find samples for building components?

When deciding whether to use an ActiveX component in your server application, keep a few things in mind:

Once you decide that you are going to use an ActiveX server component, then decide whether you want to buy or to build the component yourself, and to what extent you can reuse the same code for other pages on your site.

The component can be written in any language: Visual Basic®, C++, Java, even FORTRAN! Any tool for any language that provides support for creating COM objects can be used to create an ActiveX component.

Reusing Components

Here in the soggy U.S. Pacific Northwest, recycling is very popular. Reuse of ActiveX server components fits well into this recycling life-style. The Internet Information Server (IIS) site offers many Active Server components Non-SBN link you can download and use on your Web server. These components include the following:

Along with the components listed above, you can also access some developer samples Non-SBN link. These samples not only demonstrate the use of ASP components, but are also implemented in five different environments: Microsoft Visual C++®, using the Microsoft Active Template Library (ATL); Microsoft Visual C++, using Microsoft Foundation Classes (MFC); Microsoft Visual J++™; Microsoft Visual Basic version 4.0; and Microsoft Visual Basic version 5.0. This means you don't have to send me e-mail asking for the Visual Basic version; it's already there. Finally, you can check out the ASP Components Catalog for more components.

Building ActiveX Server Components

Okay, let's say that these reusable components don't do exactly what you need, and you've not found a component you can buy that fits your needs. You may need to build your own. There are several environments you can use to build your ActiveX server components.

Who You Gonna Ask? SBN Workshop

Once you decide what to build and which tool to use, you are probably going to look for specific tips for creating good server components. Luckily, our own Site Builder Workshop already has articles that:

ActiveX Data Objects

ActiveX Data Objects Non-SBN link (ADO) provide a collection of data access objects within an object library that enable you to write client applications that interact with databases. Those of you familiar with Data Access Objects (DAO) and Remote Data Objects (RDO) should find the programming model Non-SBN link for ADO familiar. ActiveX server components can use ADO to work with databases to provide content based on user preferences, geographical data, or any other criterion.

You can use ADO on any operating system that supports COM and OLE automation (i.e.: 32-bit Windows environments). ADO is also language neutral: you can use it from C++, Java, Visual Basic, or any other language that supports COM and OLE automation.

To get started using ADO, check out the ADO Web site Non-SBN link, and take a look there at an excerpt from the book Teach Yourself Active Web Database Programming in 21 Days Non-SBN link. Reading it will give you a very good idea of just what ADO is and why it is so cool.

If you are going to use ADO, get familiar with the most commonly used ADO interfaces:

If you are already a proficient database developer, ADO shouldn't be difficult for you to use. It is well worth the time to learn about it if you are going to create a component that needs to interact with a database.

Still with Me?

If you've gotten this far, I can safely assume that you are still interested in writing ActiveX server components and using them with your ASP files. I encourage you to spend some time on the Microsoft IIS Web site Non-SBN link to learn about ASP and the IIS environment. You can also check out the technical materials page Non-SBN link on the Microsoft OLE DB site for further reading about databases and OLE (thrilling stuff ... really!).

Even as a little tyke, developer-technology writer Nancy Winnick Cluts was always the first one to raise her hand.


Get a grasp on ASP

Active Server Pages Non-SBN link (ASP) technology provides a compile-free environment for creating server applications using any combination of HTML, scripting, and components. I've written several articles discussing the use of ASP, including an overview, tips, and general scripting. Others have written articles covering Web session management, creating ASP components, and debugging.

-- NWC

What is COM?

Component Object Model Non-SBN link (COM) technology allows you to build applications from binary components that communicate together.

When you design an application to take advantage of COM, you pull out chunks of your code that stand alone in their functionality (for example, a specific set of functions that calculate a mortgage could go into a COM component).

These code chunks are implemented within executable (.exe) files or Dynamic Link Library (.dll) files. COM objects implemented in .dll files are called in-process servers, which can expose functions to outside applications. This means that other applications, even applications written by other companies, can call these exposed functions.

COM and ActiveX


ActiveX controls are implemented as COM objects. That's how ActiveX controls interoperate across networks, whether intranets or the Internet, and that's what allows the scripting of ActiveX controls.

When COM works across networks, it is called Distributed COM Non-SBN link (DCOM). COM provides the aggregation (the way in which one object can make use of another object) for ActiveX. COM also provides the mechanism for packaging the parameters to functions (known as marshaling), so that those parameters can be passed across processes (and machines).

For technical how-to questions, check in with the Web Men Talking, the Site Builder Network's answer pair.


Did you find this article useful? Gripes? Compliments? Suggestions for other articles? Write us!

Back to topBack to top

© 1998 Microsoft Corporation. All rights reserved. Terms of use.

 

Magazine Home
Ask Jane
DHTML Dude
Extreme XML
For Starters
More or Hess
Servin' It Up
Site Lights
Web Men Talking
Member Community Home
Benefits: Freebies & Discounts
Benefits: Promote Your Site
Benefits: Connect with Your Peers
Benefits at a Glance
Online Special-Interest Groups
Your Membership
SBN Stores
Join Now
Workshop Home
Essentials
Content & Component Delivery
Component Development
Data Access & Databases
Design
DHTML, HTML & CSS
Extensible Markup Language (XML)
Languages & Development Tools
Messaging & Collaboration
Networking, Protocols & Data Formats
Reusing Browser Technology
Security & Cryptography
Server Technologies
Streaming & Interactive Media
Web Content Management
Workshop Index
Tools & Samples Home
Tools
Samples, Headers, Libs
Images
Sounds
Style Sheets
Web Fonts
Training Home
SBN Live Seminars
SBN Live Chats
Courses
Peer Support
CD-ROM Training
Books & Training Kits
Certification
SBN Home
New to SBN?
What's New on SBN
Site Map
Site Search
Glossary
Write Us
About This Site