Follow Slashdot stories on Twitter

 



Forgot your password?
typodupeerror
×
Microsoft

Journal KevMar's Journal: A Code sample I want to save 1

> Hi, I just would like to know if it s possible
> to have *any* code (C#, VB.NET, Jscript.NET ...)
> compiled to a DLL/COM/OCX ?
>
> and after that, is it possible to expose this compiled code
> to use it in WSH ?

Hi,

Sure you can do this. The two steps you need to take are to run RegAsm on
the .NET assembly, and to copy the dll into the WinNT\System32 directory.

// sample.js
package MyLibrary
{
    class MyObject
    {
        function SayHello()
        {
            print("Hello!")
        }
    }
}

c:> jsc /t:library sample.js
c:> regasm sample.dll
c:> copy sample.dll %systemroot%\system32

// useit.js
var ob = new ActiveXObject("MyLibrary.MyObject")
ob.SayHello()

c:> useit.js

    Hello!

Peter
This discussion has been archived. No new comments can be posted.

A Code sample I want to save

Comments Filter:
  • Start Visual Basic 6.0, create a new standard EXE project, add reference to Microsoft SOAP Type Library v3.0 and write the following code in the Form_Load() method:

    Dim objWebSvcClient As New MSSOAPLib30.SoapClient30
    Dim dTemp As Double

    objWebSvcClient.MSSoapInit _
    "http://www.xmethods.net/sd/2001/TemperatureServic e.wsdl"
    dTemp = objWebSvcClient.getTemp("60195")
    MsgBox dTemp
    Unload Me

There are two ways to write error-free programs; only the third one works.

Working...