Partager via


How Script Components Work

 

Windows Script Component technology consists of three pieces: the script component run-time, interface handlers, and your script component file.

Script Component Technology Parts

  • The script component run-time (Scrobj.dll) helps dispatch COM requests to your scripts. In COM terms, Scrobj.dll functions as the inproc server for script components.

  • Interface handlers are compiled components that implement specific COM interfaces. Different interface handlers come ready to work as specific types of COM components.

    The most commonly used interface handlers, including the COM Automation interface handler, an ASP interface handler, and a handler for DHTML Behaviors, are already built into the script component run-time. Others are available as add-on components, or embedded into specific applications.

  • Your script component file is a .wsc file. Script component files are XML (Extensible Markup Language) files that contain information about what type of COM component you want to create (that is, what interface handlers you want to use). Then, depending on what functionality the handler makes available, you write script in your script component to implement those interfaces.

The script component run-time serves as an entry point for the host application. The complexities of COM, including the implementation of such COM-standard interfaces as IUnknown, are embedded in the various interface handlers. Your script component contains only the script required to implement the functionality of the COM component.

For example, one of the most common types of COM components is an Automation component, which is a component with properties and methods that can be called from other applications. The low-level COM interfaces required to implement this functionality — such as dispatching to the correct function when a method is called — are built into an Automation interface handler. In your script component file, you define the properties, methods, and events you want to expose, and the Automation handler makes sure they are called correctly when the host application needs them.

See Also

Introducing Windows Script Components
Creating Script Components