Steps for writing COM components in JavaScript _javascript tips

Source: Internet
Author: User
Tags cdata
Scripting languages that support these interfaces are: Javascript/jscript, VBScript, Perl, and Python.
WSC has the following characteristics.
 Compact and efficient;
 Easy to create, maintain and deploy;
 Provides the ability to create COM parts;
 Provides the ability to access a large number of system services.
The core task of writing COM components in JavaScript is to complete a. WSC (Windows scripting Component) file.. wsc file is a standard XML file in the following format:
<?xml version= "1.0" encoding= "UTF-8"?>
<?component error= "true" debug= "true"?>
<component id= "program ID" >
<registration
description= "description"
progid= "Program ID"
version= "Version number"
classid= "type ID" remotable= "true" >
</registration>
<public>
<!--
Defining Component Methods
-->
<method name= "method Name" >
<parameter name= "Parameter 1"/>
<parameter name= "Parameter 2"/>
</method>
<!--
Defining Component Properties
-->
<property name= "Property name"/>
</public>
<resource id= "Previously defined method or property name" ><! [cdata[
Describes the previously defined method or property name
]]></resource>
<script language= "VBScript" >
<! [cdata[
Code implemented in VBScript
]]>
</script>
<script language= "JavaScript" >
<! [cdata[
Code implemented with JavaScript
]]>
</script>
</component>
The entire. Wsc file consists of component declarations, method and attribute declarations, method and property descriptions, method implementations, and so on. The process of writing COM components using scripting languages such as VBScript or JavaScript, which is the process of completing the. wsc file.
Note: COM components written in a scripting language, such as VBScript or JavaScript, perform performance that cannot be compared to COM with executable binary files such as. dll,. ocx. Because the scripting language cannot be compiled and can only run on the host, the script host on the Windows platform is WSH (Windows Scripting Host), or Windows\system32\scrobj.dll.
Calling a COM component written in a scripting language is actually a process that invokes WSH directly and then executes the script by WSH.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.