Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. COM+ & .NEt parameters by reference

COM+ & .NEt parameters by reference

Scheduled Pinned Locked Moved C#
csharpcomhelp
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    raforaez
    wrote on last edited by
    #1

    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 :)

    J 1 Reply Last reply
    0
    • R raforaez

      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 :)

      J Offline
      J Offline
      Judah Gabriel Himango
      wrote on last edited by
      #2

      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

      R 1 Reply Last reply
      0
      • J Judah Gabriel 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

        R Offline
        R Offline
        raforaez
        wrote on last edited by
        #3

        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 =)

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups