|
Creating a WSC component
Overview
Using the script components you can build components
without the need to learn another language such as Visual Basic
or Visual C++ . Some examples of their usage could be form processing
, email validation or even database access.
WSC technology comprises of 3 different parts
which are the WSC runtime which is implemented in the scrob.dll
, Interface handlers and the actual WSC files which contain
the actual information about the component .
The best tool for the job is the WSC component
wizard which yo can download
here . This tool helps greatly in producing the basic skeleton
of your WSC component .
Create our component
In this first example we will create a fairly
useless but functional component which displays a messagebox
.
First of all you start the Windows Script Component
wizard from the Microsoft Windows Script folder . You are now
presented with your first dialog box , in this box you enter
the name of your component , the filename , the progid , the
version number and the directory the component will be saved
in . The progid we use in this example is HelloWorld.SayHello
. In figure 1 you can see what we have entered clearly
figure 1 : the first step
entering your name , ProgId etc
Now press the next button and move onto the next
dialog box . In this step you can define what scripting language
you wish to use , implementation support and if you wish to
enable error checking and debugging . In our example (figure
2)we have selected VBscript , do not wish any special implementation
support and we do want error checking and debugging
figure
2 : the characteristics of the component
Once again press next and we will move on to the
next step which allows you to add properties but our component
does not have any
figure
3 : adding properties
So we click on next and move on to the next step
which allows us to add methods , we have a method called SayHello
. So click on the Name column and enter SayHello , this method
has no parameters so we will leave this blank.
figure 4 : adding our SayHello
method
Click on next and we move on to the 5th dialog
box which you use to add your events , this example doesnt have
any so we just click on next and move to the final step.
figure 5 : adding events
Now for the final step , this simply lists all
the details of your script that you have entered such as ProgId
, name , events , properties , methds etc . Press finish to
build the framework for your component .
figure 6 : finishing off
In the next installment we will add functionality
to the skeleton component , register the component and then
show you how to use the component
Part
2
|