Solved

OleVariant conversion

Posted on 2002-03-20
4
210 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Convert GUI app into console app for Win32 Env 5 124
Create a path if not exists 7 105
Delphi inherited method 6 78
JAudiorecorder record freezing the app 29 82
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

679 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