DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 1 of 1
  1. #1
    Join Date
    May 2005

    Passing Arrays in COM

    Need help with passing a BYTE array in COM.

    I think i have done it right but i only get the first byte passed.

    Here is the idl:

    interface ICOMtestObject : IUnknown
    [id(1), helpstring("method GetData")] HRESULT GetData([out]ULONG *sz,[out,size_is(,*sz)]BYTE **data);

    Here is the implementation in the COM server:

    STDMETHODIMP CCOMtestObject::GetData(ULONG *sz, BYTE **data)
    // TODO: Add your implementation code here

    *data = (BYTE*)CoTaskMemAlloc( 5 * sizeof( BYTE));

    return S_OK;

    Here is the implementation in the client:

    HRESULT hr = m_objPtr.CoCreateInstance(L"Comtest.COMtestObject.1");

    ULONG sz;BYTE *data;
    hr = m_objPtr->GetData(&sz,&data);

    The data array includes only the first byte.

    Please help me with this one.
    Attached Files Attached Files

Similar Threads

  1. Replies: 0
    Last Post: 10-16-2002, 02:48 PM
  2. Passing arrays to Oracle stored procedure
    By NJMrbig in forum VB Classic
    Replies: 0
    Last Post: 01-16-2002, 09:07 AM
  3. Replies: 2
    Last Post: 10-11-2001, 12:46 AM
  4. Replies: 1
    Last Post: 08-06-2001, 11:04 AM
  5. Passing Arrays
    By Balaji in forum VB Classic
    Replies: 0
    Last Post: 04-04-2000, 02:14 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.