Solved

OleVariant conversion

Posted on 2002-03-20
4
208 Views
Last Modified: 2010-04-05
hello
im using an activex,on method returns a multi-dimentional array (2X2) as an ole variant

How can i use it?
[should i typecast it to variant (using VarCast()..)?]
how do i access elemnts in the array?

Thanx
Tomer
0
Comment
Question by:tomer_engel
  • 2
4 Comments
 
LVL 6

Accepted Solution

by:
Stuart_Johnson earned 100 total points
ID: 6884392
Hi Tomer,


procedure FinishedActiveX(V: OleVariant);
var
  Dimensions, Elements: Integer;
  Value: String;
begin
  if VarType(V) <> (VarArray + VarVariant) then
    begin
      ShowMessage('Passed variant is not a variant array');
      Exit;
    end;
  {Dimensions tell you how many dimensions you have in the array - not elements

    DIM1  DIM2  DIM3
    ELE1  ELE1  ELE1
    ELE2  ELE2  ELE2
    ELE3  ELE3  ELE3
}

  Dimensions := VarArrayDimCount(V);

  {To find out how many elements you have in the last  dimension, use this}

  Elements := VarArrayHighBound(V, Dimensions);

  {You can then access each element in the array using:}
  Value := V[Dimension, Elements];
  {Assuming that the passed data is a string - you can check using the VarType function}
end;

For more information on Variants, check the help file.  Search for VarArrayCreate, then click on Variant Support Routines (in the D5 help file anyway).

Please feel free to ask more questions!

Cheers,

Stu
0
 
LVL 1

Author Comment

by:tomer_engel
ID: 6886291
hey stu,thanx
let me get back to you in few says

Tomer
0
 

Expert Comment

by:CleanupPing
ID: 9343240
tomer_engel:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
LVL 6

Expert Comment

by:Stuart_Johnson
ID: 9356076
Hi Tomer,

Just out of curiosity, how come you only awarded my answer 'B' grading?  Did it not help?

Stuart.
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question