COM+ & .NEt parameters by reference
-
Hi friends: I want send parameters by reference in my .Net application. but i am using a COM+ object's method :( My code is: ----------------------------------------------------------------------- Object[] args = new Object[12]; args[0] = Agencia; args[1] = Sector; args[2] = Ticketera; string[] argNames = {"cAgencia", "cSector", "cTicketera"}; res=atype.InvokeMember("b_GenerarTck",BindingFlags.InvokeMethod,null,objTicket, args,null,null,argNames); ----------------------------------------------------------------------- BUT IT CAN'T GET THE REFERENCES I HOPE THAT YOU CAN HELP ME Thanks :)
-
Hi friends: I want send parameters by reference in my .Net application. but i am using a COM+ object's method :( My code is: ----------------------------------------------------------------------- Object[] args = new Object[12]; args[0] = Agencia; args[1] = Sector; args[2] = Ticketera; string[] argNames = {"cAgencia", "cSector", "cTicketera"}; res=atype.InvokeMember("b_GenerarTck",BindingFlags.InvokeMethod,null,objTicket, args,null,null,argNames); ----------------------------------------------------------------------- BUT IT CAN'T GET THE REFERENCES I HOPE THAT YOU CAN HELP ME Thanks :)
What does the COM object's method signature look like? FYI, you can pass COM [in,out] parameters using the C# ref keyword. Additionally, you can pass COM [out] parameters using C# out keyword.
Tech, life, family, faith: Give me a visit. I'm currently blogging about: Homosexuality in Christianity Judah Himango
-
What does the COM object's method signature look like? FYI, you can pass COM [in,out] parameters using the C# ref keyword. Additionally, you can pass COM [out] parameters using C# out keyword.
Tech, life, family, faith: Give me a visit. I'm currently blogging about: Homosexuality in Christianity Judah Himango
this is the Signature of the method in VB 6.0 : Public Function b_GenerarTck(ByVal cAgencia As String, _ ByVal cSector As String, _ ByVal cTicketera As String, _ ByVal cTTckBase As String, _ ByRef OUT_cTicket As Variant, _ ByRef OUT_dTicket As Variant, _ ByRef OUT_fGenerado As Variant, _ ByRef OUT_hGenerada As Variant, _ ByRef OUT_nEsperaMinima As Variant, _ ByRef OUT_dTTicket As Variant, _ ByRef OUT_dTVentanilla As Variant, _ Optional ByVal nNumCliente As Variant, _ Optional ByVal dNomCliente As Variant) As Long The following code is the solution for a method with 1 parameter .... but doesn´t work with several parameters -------------------------------------------------------------------- using MyMFCLibrary; using System.Reflection; public class MyClass { MyMFCAutomationServer objTest = new MyMFCAutomationServerDoc(); object [] arglist = { "Hello World!" }; ParameterModifier pm = new ParameterModifier(1); //Set the VT_BYREF flag on the first parameter. p[0] = true; //Create an array of ParameterModifier objects, and then put in your element. ParameterModifier [] pmArray = { pm }; //Use late binding and call the method. objTest.GetType().InvokeMember("VariantByRef", BindingFlags.InvokeMethod, null, objTest, arglist, pmArray, null, null); } ------------------ Please helpme guys =)