Article View: borland.public.delphi.com.activex.using
Article #10SafeArray of Objects
From: JimL
Date: Thu, 28 Jun 2007 15:17
Date: Thu, 28 Jun 2007 15:17
64 lines
2282 bytes
2282 bytes
I'm accessing a function in a COM object which returns a SafeArray of
Objects from Delphi 2007.
I'm having trouble getting any readable information.
Here are some excerpts from the type library:
IZeacomMLI = interface(IDispatch)
['{BF0264BA-34FF-11D5-97CB-00E02915CAEC}']
...
function GetAgentList: PSafeArray; safecall;
...
end;
IZeacomMLIDisp = dispinterface
['{BF0264BA-34FF-11D5-97CB-00E02915CAEC}']
...
function GetAgentList: OleVariant; dispid 6;
...
end;
When calling the function GetAgentList a SafeArray of Objects is
supposed to be returned as follows:
-- AgentInfo Properties --
LoginID Long Integer
FirstName String
LastName String
I'm able to get a count of items in the array,
but I don't know how to define the object so I can get information from
it.
here is what I've done so far:
type
TAgentInfo = packed record
LoginID: Integer;
First: WideString;
Last: WideString;
end;
..
procedure RetrieveAgents(I:IZeacomMLI);
var
AL:PSafeArray;
AREC:TAgentInfo;
iLow,iHigh,p:integer;
begin
AL := I.GetAgentList;
SafeArrayGetLBound(AL,1,iLow);
SafeArrayGetUBound(AL,1,iHigh);
for p :=iLow to iHigh do
begin
getResult := SafeArrayGetElement(AL, p, AREC);
ShowMessage(AREC.First);
ShowMessage(AREC.Last);
end;
end;
I get nothing but garbage from what I'm doing right now
Jim
--- posted by geoForum on http://delphi.newswhat.com
Technical Details
Message-ID:
<4683c5b3@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!newsgate.cistron.nl!xs4all!feeder.news-service.com!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 123df9,115be65d49f12611,start X-Google-Attributes: gid123df9,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: "JimL" <anonymjim@yahoo.com> Subject: SafeArray of Objects Newsgroups: borland.public.delphi.com.activex.using Date: Thu, 28 Jun 2007 16:17:05 +0100 X-Priority: 3 X-Library: Indy 9.00.12 X-Newsreader: <dedXmlGateway> NNTP-Posting-Host: 213.26.58.195 Message-ID: <4683c5b3@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1183040947 213.26.58.195 (28 Jun 2007 07:29:07 -0700) Lines: 64 Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!newsgate.cistron.nl!xs4all!feeder.news-service.com!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail