![]() |
|
|
Published: Thursday, May 04, 2000
This article assumes that the reader knows what COM components are and how to create them using a high-level language. If you are new to COM components, you should first read: Writing a COM Component with VisualBasic. COM components provide several advantages over ASP. While performance increases are one advantage to using COM objects over ASP code, COM components also help encapsultate implementation complexity. For example, imagine that you had an ASP page that added a row to a database table. If this logic were embedded in the ASP page, the ASP developer would need to know the database table structure, what the various column bounds were, etc. Using a component, however, the developer only needs to set a few properties and then call a method to insert the row. This approach does not require that the ASP developer have any knowledge on the actual table structure, what column input is invalid, etc. COM components can be created by a plethora of high-level programming languages, including VisualBASIC, Visual C++, and Java. One of the biggest disadvantages of developing COM components using one of these high-level languages is the time-intensive process of altering an existing COM component. For example, say that you are developing a COM component. You add some properties and methods and start using it on your site. Now, say that you wanted to add a new method. After adding this method you would have to recompile the COM component, reregister it, and stop and restart the Web server. (For a more detailed description of this process be sure to read: Recompiling VB Components.) To solve for this annoyance, Microsoft has created Windows Script Components, which, as their name implies, are COM components created with script! These components can be developed with any Windows scripting language (VBScript, JScript, PerlScript, Python, etc.). Since these components use script, you can literally cut and paste your ASP script into one of these scripted components! Also, you can edit a Windows Script Component's code and the changes are automatically reflected - no recompiling, no restarting the Web server, and no reregistering the component! To get started developing your own Windows Script Components you'll need to download the Windows Script Component Files from Microsoft's Scripting Site (freely available). While you're there, also be sure to download the Windows Script Component Wizard, which we'll be using in this article to create the skeleton to our Windows Script Component. Once you download these files, be sure to install them.
The Windows Script Component Wizard is a helpful six-step Wizard that will generate the
shell of our Windows Script Component. A Windows Script Component is a simple text file
with a
For this article we will create a COM component that will convert a Celcius temperature
to a Fahrenheit temperature and vice versa. The component will have no properties or
events, and two methods:
To start creating your Windows Script Component, start up the Wizard (after it is installed
it should be in Start/Program/Microsoft Windows Script/Windows Script Wizard). In Step 1
you need to enter the registration information which includes the name of the component,
its filename, its version, and its ProgID. The ProgID is what is used to instantiate the
object in an ASP page (
In Part 2 we will look at the reamining five steps of the Wizard!
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
![]() |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||