Lỗi no components are defined in the file năm 2024

I'm trying to get a Windows Script Component working on and x64 development machine. Works fine on x32 bit. But can't seem to get it running, I have the same problem with both JScript and VBScript.

Here's the most simple wsc component possible. All that it does it pop up "Hello" in a message box. If you save the snippit below to a file called test_lib.wsc, you'll then be able to right click and register it. It's now available as a COM Component.







  
  



Next create the following sample vb-script and save it to a file called test.vbs

dim o
set o = createobject("TestScript.Lib")
o.hello()

When I run the test.vbs with cscript or wscript I always get the following. "C:\test.vbs(3, 1) Microsoft VBScript runtime error: ActiveX component can't create object: 'TestScript.Lib'"

This works perfectly fine on a 32 bit XP. Anyone got any ideas about what could be wrong?

Thanks a bunch Noel.

vy32

28.9k37 gold badges125 silver badges254 bronze badges

asked Feb 11, 2010 at 12:53

Registering the wsc from the Wndows Explorer context menu, everything worked fine for me on 64bit Windows 7.

I had problems running from a 32 bit command prompt, there I had to re-register the wsc with regsvr32 from %windir%\sysWOW64, then it ran fine with both 64 and 32 bit versions of cscript.exe, when run from either 64 or 32 command prompt.

Are you sure when you're registering the wsc, that you are using the regsvr32 from the %windir%\sysWOW64 folder?

There are two versions of regsvr32, one 32 bit (in sysWOW64), one 64 bit (in system32) they're both named regsvr32.

Windows® Script Component files are XML (Extensible Markup Language) that are much like HTML files, but contain special elements that define the script component and its behavior. The elements used for defining script components are not HTML tags, but are XML elements specifically used for script component definitions.

Elements of a Basic Script Component File

  • and elements The element encloses one entire script component definition. Multiple elements can appear in the same .wsc file, and are contained within a master element.
  • element Includes information used to register your script component as a COM component. This element might not be required if the host application (such as Microsoft® Internet Explorer 5.0) does not directly use the Windows registry when creating an instance of the script component.
  • element Encloses definitions for properties, methods, and events that your script component exposes. The definitions point to variables or functions defined in a separate

  This skeleton shows how script component elements are   
  assembled into a .wsc file.  
progid="_progID_" description="_description_" version="_version_" clsid="_{00000000-0000-0000-000000000000}_"/>
    
    
    
COMhandlerName id=internalName>
  (interface-specific definitions here)  
string or number here string or number here

Lỗi no components are defined in the file năm 2024
Note

In XML, you can specify elements without content (attributes only), such as the and elements in the previous example, by closing the element with />.

Note that: