Article View: borland.public.cppbuilder.nativeapi
Article #5310Re: Help with SAFEARRAY
From: Mark Guerrieri
Date: Fri, 16 Sep 2005 23:23
Date: Fri, 16 Sep 2005 23:23
46 lines
2321 bytes
2321 bytes
Check the comments in the file <safearry.h> for help on using SAFEARRAY
wrappers...
#include <safearry.h>
void __fastcall CallGetSymbols()
{
int nDim1 = 1; //Number of items for Symbols
int nDim2 = 1; //Number of items for WordenNumbers
//Note- I used 1 for the number of elements because that is
//what it look slike AllocateArray is doing...
//Also note that TSafeArrayDim1 sets the lower bound to 0 while your
AllocateArray is setting to 1...
TSafeArrayDim1 SymbolsDim(nDim1);
TSafeArrayDim1 WordenNumbersDim(nDim2);
TSafeArrayBSTR1 Symbols(SymbolsDim);
TSafeArrayLong1 WordenNumbers(WordenNumbersDim);
//If arrays need to be prefilled, use the following.
//If you are just passing empty arrays into GetSymbols and letting
GetSymbols fill in the arrays,
//the skip...
for(int i=0; i<nDim1; i++)
{
AnsiString cVal;
//set cVal to whatever...
Symbols[i] = WideString(cVal).Detach();
}
for(int i=0; i<nDim2; i++)
{
int nVal;
//set nVal to whatever...
WordenNumbers[i] = nVal;
}
GetSymbols( &Symbols, &WordenNumbers);
}
Mark
Technical Details
Message-ID:
<432b5388$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!elnk-atl-nf1!newsfeed.earthlink.net!nx02.iad01.newshosting.com!newshosting.com!newsfeed.icl.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<4329d38a@newsgroups.borland.com> <4329da90$1@newsgroups.borland.com> <432a15a0@newsgroups.borland.com> <432a2b61$1@newsgroups.borland.com> <432a52cc@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,d0eb3921b71e7751 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Mark Guerrieri" <mguerrieri@nospam_cmsgrp.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <4329d38a@newsgroups.borland.com> <4329da90$1@newsgroups.borland.com> <432a15a0@newsgroups.borland.com> <432a2b61$1@newsgroups.borland.com> <432a52cc@newsgroups.borland.com> Subject: Re: Help with SAFEARRAY Date: Fri, 16 Sep 2005 19:23:11 -0400 Lines: 48 Organization: Creative Marketing Strategies X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 209.50.174.82 Message-ID: <432b5388$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1126912904 209.50.174.82 (16 Sep 2005 16:21:44 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!elnk-atl-nf1!newsfeed.earthlink.net!nx02.iad01.newshosting.com!newshosting.com!newsfeed.icl.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail