Solved

OleVariant conversion

Posted on 2002-03-20
4
211 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

732 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