|
Hi,
I am unable to access all properties and methods in a COM .DLL that I
have. The properties and methods exposed by the .dll all appear as
"abstract" when I view them in the Object Browser.
To illustrate they look something like this:
COMComponent (ie foo.dll)
public abstract new ComComponent.Property1_ Property[ get]
public abstract new void Method1( )
After a bit of research on this I have found that I need to create a
class that derives from the COM object and then access the new class.
Visual Studio automatically completed the declaration of this for me and
gave me something like you see bellow.
public MyClass:COMComponent.Class
{
public ComComponent.Property1_ Property
{
get
{
// TODO: Add MyClass.Property getter implementation
return new ComComponent.Property1_ ();
}
}
public ComComponent.Method1(string param1, out object param2)
{
// TODO: Add MyClass.Method1 implementation
param2 = null;
}
}
It then seems like a simple matter to access the COM object as follows:
static void main()
{
MyClass NewObj = new MyClass();
System.Console.WriteLine("Result: {0}", NewObj.Property);
}
How do I directly access the underlying class? To illustrate because the
COM objects declaration is abstract I am unable to create a new
reference to it directly (ie ComComponent.Something foo = new
ComComponent.Something()) or to access its members directly.
Thanks in advance |