Thanks for this - I will do it like this if I cannot solve the problem any
other way - I am just puzzled as to why my static methods are not working
but the system ones are?

tom

-----Original Message-----
From: Unmoderated discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] On Behalf Of Steve Johnson
Sent: 14 July 2004 14:28
To: [EMAIL PROTECTED]
Subject: Re: [ADVANCED-DOTNET] Invoke .NET static methods in COM

Tom Hyland wrote:

> I am having a problem invoking static methods on a .NET class via COM.

I can't answer the question, but I thought I would suggest how I do
this.  In order to alleviate all that hideous goo you need to invoke a
static member, I create wrappers that delegate, like so:

[ComVisible(false)]
public class MyClass
{
   public static void MyMethod() {}
}

[ComVisible(true)]
[Guid(?)]
[ProgId(?)]
public class MyClassComWrapper
{
   public MyClassComWrapper() {}

   public void MyMethod()
   {
      return MyClass.MyMethod
   }
}



I think this is much easier, but there's probably a reason you need to
do things the other way.


--
Steve Johnson

===================================
This list is hosted by DevelopMentorR  http://www.develop.com
Some .NET courses you may be interested in:

NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls

View archives and manage your subscription(s) at http://discuss.develop.com

===================================
This list is hosted by DevelopMentor�  http://www.develop.com
Some .NET courses you may be interested in:

NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to