InterviewSolution
| 1. |
Solve : COM object? |
|
Answer» Hi Next step is to register your component with regsvr32 path\componentname.wsc where do we write this syntax? Thanks for help. The default location of regsvr32 is the system32 directory. You can RUN the utility from either the command prompt or the start==>run box. There is a /s switch to eliminate any message boxes. You can GET the offical information here. description="My Test Component" progid="Component.TestScript" version="1" classid="{2154c700-9253-11d1-a3ac-0aa0044eb5f}" Function factorial(n) If isNumeric(n) Then If n <= 1 Then factorial = 1 Else factorial = n*factorial(n-1) End If Else factorial = -2 ' Error code. End If End Function ]]> I copied this as a wsc file and stored it in d drive. in cmd when i am typing regsvr32 d:\component.wsc I am gettin the following error: [3,2]A required attribute is missing : progid, clasid, or classid. I don't see any thing missing? then what's the problem? Thanks for helping me. There was a name property I COULD find no reference to. There were also some missing tags and a missing parameter for the factorial function. Code: [Select]<?xml version="1.0"?> <component> <registration description="My Test Component" progid="Component.TestScript" version="1.00" classid="{2154c700-9253-11d1-a3ac-0aa0044eb5f}" > </registration> <public> <method name="factorial"> <PARAMETER name="n"/> </method> </public> <script language="VBScript"> <![CDATA[ Function factorial(n) If isNumeric(n) Then If n <= 1 Then factorial = 1 Else factorial = n*factorial(n-1) End If Else factorial = -2 ' Error code. End If End Function ]]> </script> </component> Good luck. |
|