Re: OLEAutomation Interop with object []
From: Robert Jordan (robertj_at_gmx.net)
Date: 08/27/04
- Next message: Robert Jordan: "Re: problem crashing in callback to C# method from win32 dll"
- Previous message: Wei-Dong XU [MSFT]: "RE: Q230743 Set Duplex Printing for Word Automation"
- In reply to: Phil Wilson: "OLEAutomation Interop with object []"
- Next in thread: Willy Denoyette [MVP]: "Re: OLEAutomation Interop with object []"
- Reply: Willy Denoyette [MVP]: "Re: OLEAutomation Interop with object []"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 27 Aug 2004 10:13:23 +0200
Hi Phil,
> There doesn't seem to be an obvious (to me anyway!) way to have an interface
> in .NET that passes an object [] such that it can be used by (say) VBScript.
> In other words, given a method:
>
> [ComVisible(true), GuidAttribute("66F12379-0C8F---------- etc")]
> [ClassInterface(ClassInterfaceType.AutoDispatch)]
> [ProgId("blah.blah")]
> public class Class1: IMyInterface
> {
> ..
> public void Connect(object [] initializeData )
>
> }
>
> What is required (MarshalAs or whatever) is that this kind of script works:
You don't need any special marschal instructions, because
the runtime already has a default marschaler for "object[]".
However, VBScript is not able to pass the expected SAFEARRAY
by value. It simply doesn't support that. You have to change
the managed signature from
public void Connect(object [] initializeData )
to
public void Connect(ref object [] initializeData )
>
> set obj = createobject("blah.blah")
> dim parm(2)
> parm (1) = "this"
> parm(2)="that"
>
> obj.Connect parm
>
> The error is pretty consistent at 0x800A0005 Invalid procedure call or
> argument: 'obj.Connect'
Rob
- Next message: Robert Jordan: "Re: problem crashing in callback to C# method from win32 dll"
- Previous message: Wei-Dong XU [MSFT]: "RE: Q230743 Set Duplex Printing for Word Automation"
- In reply to: Phil Wilson: "OLEAutomation Interop with object []"
- Next in thread: Willy Denoyette [MVP]: "Re: OLEAutomation Interop with object []"
- Reply: Willy Denoyette [MVP]: "Re: OLEAutomation Interop with object []"
- Messages sorted by: [ date ] [ thread ]