O'Reilly logo

VBScript in a Nutshell, 2nd Edition by Ron Petrusha, Matt Childs, Paul Lomax

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 9. Windows Script Components

Windows Script Components (WSC) is a technology that allows programmers using scripting languages like VBScript to create COM components (that is, components based on Microsoft’s Component Object Model technology). Ordinarily, COM component creation requires a compiled programming language, such as C++ or Visual Basic. Windows Script Components relies on a runtime module (scrobj.dll ) that handles the implementation details of COM, while a script file parsed by the script engine contains the component definition.

The source code for a script component is stored in a Windows Script Component (.wsc ) file. This is an XML file that contains the component definition, along with the code for the properties, methods, and events that the component exposes.

In addition, Windows Script Components supports interface handlers , which are compiled COM components that provide the implementation for particular interfaces. Windows Script Components automatically provides support for the interfaces necessary for COM automation, ASP, and DHTML.

Windows Scripts Components automates much of the process of creating a COM component by providing a wizard that collects information on the component to be created and writes it to a .wsc file. To illustrate the operation of the wizard, we’ll create a simple math component.

The Script Component Wizard

The opening screen of the Script Component Wizard is shown in Figure 9-1. Although the dialog contains a number of text ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required