CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 1999
    Posts
    4

    HOW to pass ARRAY OF STRUCTURES in COM DYNAMICALLY thru interface methods

    Can any body tell me how do i pass ARRAY OF STRUCTURES IN COM DYNAMICALLY FROM A outproc server to client.
    eg..
    I have a structure A { int x, float y, char z} of size [n] .. i would like to fire this data through my outgoing interface . Is there any way please
    reply me.

    srini s ([email protected])


  2. #2
    Join Date
    May 1999
    Location
    UK
    Posts
    59

    Re: HOW to pass ARRAY OF STRUCTURES in COM DYNAMICALLY thru interface methods

    Look at COleSafeAray. You can create a 1 dimensional byte array COleSafeArray::CreateOneDim

    copy your structure byte-per-byte into the array, then get the VARIANT out of the array using ColeSafeArray:etach()

    . You now have your structure in a VARIANT, which can be marshalled by both COM & DCOM. Also you have to free the memory allocated manually (since you called Detach()); call VariantClear() to do the job.

    MJA

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured