Hinweise und Notizen zum Quellcode
- Object statt Variant in COM Interface:
[MarshalAs(UnmanagedType.IDispatch)]
void CallTestByName(string procName, [MarshalAs(UnmanagedType.IDispatch)] out object test2Add);
object Fixture { [return: MarshalAs(UnmanagedType.IDispatch)] get; }
object Parent { [param: MarshalAs(UnmanagedType.IDispatch)] set; [return: MarshalAs(UnmanagedType.IDispatch)] get; }
- ByRef-Übergabe mit InvokeMember und Application.Run: ParameterModifier verwenden - damit kann ByRef markiert werden
object[] parameters = { getTestClassFactoryProcedureName(className), new Object() };
ParameterModifier p = new ParameterModifier(2);
p[1] = true;
ParameterModifier[] modifiers = { p };
OfficeApplication.GetType().InvokeMember("Run", BindingFlags.InvokeMethod, null, OfficeApplication,
parameters, modifiers, null, null);