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. COM
  4. How to pass out an array from a com+ object?

How to pass out an array from a com+ object?

Scheduled Pinned Locked Moved COM
c++comsysadmindata-structureshelp
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.
  • L Offline
    L Offline
    Lizp
    wrote on last edited by
    #1

    I am developing an application which need to pass an array from a com+ object to the client,the object runs at the server and the client app runs at a workstation.the problem is i can't get the actual array at the client's side. some represetative code follows: //.idl [id(15), helpstring("method GetAllPolicyID")] HRESULT GetAllPolicyID([in,out]long* size,[out,size_is(,*size)] long** PolicyID); //.cpp *size=pRst->RecordCount; *PolicyID=(ULONG*)CoTaskMemAlloc(*size*sizeof(ULONG)); for(long i=0;i<*size;i++) { if(!pRst->adoEOF) { vt=pRst->GetCollect("POLICYID"); (*PolicyID)[i]=vt.lVal; pRst->MoveNext(); } } Scratch

    S 1 Reply Last reply
    0
    • L Lizp

      I am developing an application which need to pass an array from a com+ object to the client,the object runs at the server and the client app runs at a workstation.the problem is i can't get the actual array at the client's side. some represetative code follows: //.idl [id(15), helpstring("method GetAllPolicyID")] HRESULT GetAllPolicyID([in,out]long* size,[out,size_is(,*size)] long** PolicyID); //.cpp *size=pRst->RecordCount; *PolicyID=(ULONG*)CoTaskMemAlloc(*size*sizeof(ULONG)); for(long i=0;i<*size;i++) { if(!pRst->adoEOF) { vt=pRst->GetCollect("POLICYID"); (*PolicyID)[i]=vt.lVal; pRst->MoveNext(); } } Scratch

      S Offline
      S Offline
      soptest
      wrote on last edited by
      #2

      You must produce a proxy-stub DLL by compiling and linking the C files produced by MIDL. The ATL AppWizard produces a make file called projectps.mk to do this. You must make sure that your server does not register its component's interfaces as type library marshaled with the automation marshaler because automation does not recognize the array attributes. (marshaling done by custom marshaler in your proxy/stub DLL) soptest

      L 1 Reply Last reply
      0
      • S soptest

        You must produce a proxy-stub DLL by compiling and linking the C files produced by MIDL. The ATL AppWizard produces a make file called projectps.mk to do this. You must make sure that your server does not register its component's interfaces as type library marshaled with the automation marshaler because automation does not recognize the array attributes. (marshaling done by custom marshaler in your proxy/stub DLL) soptest

        L Offline
        L Offline
        Lizp
        wrote on last edited by
        #3

        Thank for your help! And how to avoid registerring the interfaces as automation marshaler? Scratch

        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