Solved

OleVariant conversion

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

746 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now