M
mclp
I have an object created within a C++/CLI class library that I want to
expose to a VBScript client. The class is declared as:
[ClassInterface(ClassInterfaceType::AutoDispatch)]
public ref class Foo
{
public:
// some methods...
};
The object is constructed using
Foo^ foo = gcnew Foo;
Then I try to get the COM/IDispatch interface to expose to Windows
Scripting Host, using:
Object^ my_obj = foo;
IntPtr aDisp = Marshal::GetIDispatchForObject(my_obj); //
InvalidCastException here!
This results in System.InvalidCastException. Any ideas why?
expose to a VBScript client. The class is declared as:
[ClassInterface(ClassInterfaceType::AutoDispatch)]
public ref class Foo
{
public:
// some methods...
};
The object is constructed using
Foo^ foo = gcnew Foo;
Then I try to get the COM/IDispatch interface to expose to Windows
Scripting Host, using:
Object^ my_obj = foo;
IntPtr aDisp = Marshal::GetIDispatchForObject(my_obj); //
InvalidCastException here!
This results in System.InvalidCastException. Any ideas why?