Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>OK I found the solution and I'll write it here for the common good.</p> <ol> <li> Start VS2010 as administrator. </li> <li> Open a class library project (exmaple - MyProject). </li> <li> Add a new interface to the project (see example below). </li> <li> Add a <code>using System.Runtime.InteropServices;</code> to the file <li> Add the attributes InterfaceType, Guid to the interface. </li> <li> You can generate a Guid using Tools->Generate GUID (option 4).</li> <li> Add a class that implement the interface. </li> <li> Add the attributes ClassInterface, Guid, ProgId to the interface.<br/> ProgId convention is {namespace}.{class} </li> <li> Under the Properties folder in the project in the AssemblyInfo file set ComVisible to true. </li> <li> In the project properties menu, in the build tab mark "Register for COM interop" <li> Build the project </ol> <p>now you can use your COM object by using it's ProgID.</p> <p>example: the C# code:</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Runtime.InteropServices; namespace Launcher { [InterfaceType(ComInterfaceType.InterfaceIsDual), Guid("XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX")] public interface ILauncher { void launch(); } [ClassInterface(ClassInterfaceType.None), Guid("YYYYYYYY-YYYY-YYYY-YYYY-YYYYYYYYYYY"), ProgId("Launcher.Launcher")] public class Launcher : ILauncher { private string path = null; public void launch() { Console.WriteLine("I launch scripts for a living."); } } } </code></pre> <p>and VB script using the COM:</p> <p><code> set obj = createObject("PSLauncher.PSLauncher") obj.launch() </code></p> <p>and the output will be:</p> <p>I launch scripts for a living</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload