RE: Exposing DotNet assemblies to COM

  • From: "Jamal Mazrui" <Jamal.Mazrui@xxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Fri, 1 Feb 2008 12:30:44 -0500

Is GetInstance a static method?  The regasm utility only exposes public
classes and instance members via COM.  Try putting the GetInstance code
inside a class constructor method.   When the COM client uses
CreateObject (or equivalent), the ProgID passed should (by default) be a
"NamespaceName.ClassName" string.  The return value will be an object
instance of the class.

Hope this helps,
Jamal
--Original Message--
From: programmingblind-bounce@xxxxxxxxxxxxx
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Macarty, Jay
{PBSG}
Sent: Friday, February 01, 2008 11:12 AM
To: programmingblind@xxxxxxxxxxxxx
Subject: Exposing DotNet assemblies to COM 

All,
The good news is that I have a DotNet assembly to access the SSIP voice
server now; so, you can include it and use the methods like SayImportant
or SayText (there is a Say method for each of the 5 SSIP voice priority
levels). Also, you can use the properties like API or Voice to control
the output. A typical use of the SSIPClient at the beginning of a
program might look something like this:

using SSIPClient;
....
  public SSIPDemo()
  {
    SSIPClient voice = SSIPClient.GetInstance(); // default to localhost
port 3891 
    voice.API = "AUTO"; // look for active screen reader or SAPI 
    voice.SayImportant("Demo program now running");
  }

Since the "AUTO" setting is actually the default for the API property,
that line wasn't truly necessary. It just showed how to set the value.
Other values for this property include JAWS, WINEYES, SA, and SAPI if
you know which interface you wish to use.

My problem is this. I am trying to expose the methods and properties of
the SSIPClient to COM so the client can be used by any language
supporting COM objects. This is supposed to be a relatively simple task
I have included the [ComVisible(true)] directive and the other COM
directives suggested in the book I have. It compiles and I can run the
regasm utility and it says that the library was registered successfully.
However, I get an error in my script when I try to create the COM
object. 

Does anyone have some pointers on exposing DotNet classes to COM or
where I can find some good documentation on this topic?
      


------------------------------------------------------------
Jay Macarty - Masterfiles Technical Lead - PBSG
Phone: 972-963-1387
 Cell: 214-549-3421
__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind

Other related posts: