🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: microsoft.public.win32.programmer.ole
Article #6

Re: Dynamic 2-dimensional array as parameter for COM method?

#6
From: Shankara Narayanan
Date: Mon, 01 Feb 1999 00:00
54 lines
2738 bytes
hi,

Sorry If i am repeating . Any dimension of array can be packed as Variant and
sent to VB. If U are using any custom interface i.e. Derieved from IUnknown,
it will not be visible to the VB client.  But it can be seen through the
C++/VC++ client. An example in VC which creates an array of variants (single
dim.)

GetArray(VARIANT *varArr)
{
VARIANT varArray;
varArray.vt = VT_ARRAY | VT_VARIANT.

SafeArrayCreate(varArray.parray, dim,...)
*varArr = varArray;
// And use SafeArrayPutElement and SafeArrayGetElement to put and get data
}

and in vb
dim x as new obj
dim v as variant
obj.getArray(v)
' Access the array
msgbox v(0)...

Sorry I am not weel versed with VB.
Otherwise, u can send with a size_is parameter.

Regards
Shankara Narayanan

In article <36b2516d.85013812@enews.newsguy.com>,
  dmorgen@alum.mit.edu (David Morgenlender) wrote:
> I have to pass a 2-dimensional array as an input parameter to a COM method.
> Neither dimension is known at compile time.  The interface is derived from
> IUnknown.  The clients will be written in C++ & VB.  I already have dynamic
> 1-dimensional arrays working in both C++ & VB.  But I haven't been able to
find
> any way to specify a dynamic 2-dimensional array in the .IDL file.  I can, of
> course, convert it to a 1-dimensional array as far as COM is concerned.  But
I'd
> rather keep it as 2-dimensional, if possible, to keep the code more readable,
> etc.
>
> Any ideas?
>
> =======================================================
> Dave Morgenlender
> e-mail: dmorgen@alum.mit.edu
> =======================================================
>

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    
Technical Details
Message-ID: <793kaq$a3o$1@nnrp1.dejanews.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <36b2516d.85013812@enews.newsguy.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f9701,d933c915558e7daf
X-Google-Attributes: gidf9701,public
X-Google-Thread: 108cda,d933c915558e7daf
X-Google-Attributes: gid108cda,public
X-Google-Thread: fe15c,d933c915558e7daf
X-Google-Attributes: gidfe15c,public
From: Shankara Narayanan <shanki@polaris.co.in>
Subject: Re: Dynamic 2-dimensional array as parameter for COM method?
Date: 1999/02/01
Message-ID: <793kaq$a3o$1@nnrp1.dejanews.com>
X-Deja-AN: 439267810
References: <36b2516d.85013812@enews.newsguy.com>
X-Http-Proxy: 1.0 proxy1, 1.0 x13.dejanews.com:80 (Squid/1.1.22) for client 206.103.12.125
Organization: Deja News - The Leader in Internet Discussion
X-Article-Creation-Date: Mon Feb 01 07:15:41 1999 GMT
Newsgroups: microsoft.public.win32.programmer.ole,comp.os.ms-windows.programmer.ole,borland.public.cppbuilder.activex
X-Http-User-Agent: Mozilla/4.0 (compatible; MSIE 4.01; Windows NT)