> No change whatsoever using the arg array copy method you outlined.
Okay, I think at this point, we've solved the Interposer problem and we're
into the subject of Interop and pass-by-value vs. pass-by-reference. If
you're just passing the arguments as they come from the message, it's not
going to work. IDispatch.Invoke() requires that out parameters be passed by
reference; that is VT_BYREF has to be set. In order for you to get this to
work, you must do the ParameterModifier thing:
object[] args = new object[] { 222 };
System.Reflection.ParameterModifier pm =
new System.Reflection.ParameterModifier( 1 );
pm[ 0 ] = true;
System.Reflection.ParameterModifier[] pms =
new System.Reflection.ParameterModifier[ 1 ] { pm };
type.InvokeMember(
"DoSomething",
System.Reflection.BindingFlags.InvokeMethod,
null,
instance,
args,
pms,
null,
null );
Of course, this by itself is not going to work as I've listed it. You must
analyze the method being called in terms its parameters. Each parameter
will need a corresponding ParameterModifier set properly based on whether
the parameter is an in-, out-, or ref-type. You can then make the call (via
InvokeMember) and copy the modified parameters back into the original
message...
Good luck!
BTW, I recall an old thread in the DOTNET archives where Adam Nathan talks
about VT_VARIANT | VT_BYREF not being supported. I say this because of the
following function (that was sent to me out-of-band):
HRESULT bcRACIsEnabled([out] VARIANT *pvtAuthenticationKey, [out]INT*
piIsEnabled);
You may find yourself having trouble with this one...
You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced
DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.