Board index » delphi » Using ADOMD & Delphi 3.02 - Problem passing PSafeArray

Using ADOMD & Delphi 3.02 - Problem passing PSafeArray

Hi,

Trying to use ADOMD with Delphi 3.02, need to use a function which is
defined in the TLB import as :-

"function Item(var idx: PSafeArray): Cell; safecall;"

In C++ this equates to

"Item( [in] SAFEARRAY(VARIANT)* idx, [out, retval] Cell** ppvObject);"

How do create the variable required in delphi and pass a pair of integer
values i.e. [1,1]. I have tried to use Variant arrays, as suggested in
previous threads on similar subjects, unfortunately all I get is an access
violation.

The purpose of the call is to retrieve a single "cell" value from an ADOMD
"cellset" object which already contains an array of values.

Help/Examples much appreciated..
Steve

 

Re:Using ADOMD & Delphi 3.02 - Problem passing PSafeArray


var
  p:PsafeArray;
Begin
  Getmem(p, 4);
  Item(@P);

// This is gess.

Quote
steve borthwick wrote:
> Hi,

> Trying to use ADOMD with Delphi 3.02, need to use a function which is
> defined in the TLB import as :-

> "function Item(var idx: PSafeArray): Cell; safecall;"

> In C++ this equates to

> "Item( [in] SAFEARRAY(VARIANT)* idx, [out, retval] Cell** ppvObject);"

> How do create the variable required in delphi and pass a pair of integer
> values i.e. [1,1]. I have tried to use Variant arrays, as suggested in
> previous threads on similar subjects, unfortunately all I get is an access
> violation.

> The purpose of the call is to retrieve a single "cell" value from an ADOMD
> "cellset" object which already contains an array of values.

> Help/Examples much appreciated..
> Steve

Other Threads