Delphi, OleVariant shows as Unknown type: 18928

I have an Activex component that I'm calling from Delphi, in VB the return value that i'm looking for is easy to read
Private Sub m_rs_onReportCreationNotification(ByVal repordId As String, orderIds() As String, examIds() As String, ByVal succeeded As Boolean)
    On Error GoTo ErrorHandler
   
    Dim order, exam As Variant
    Dim logorders, logexams, state As String
   
    For Each order In orderIds
       logorders = logorders + order + ", "
    Next


In Delphi

procedure TForm4.ReportStation1onReportCreationNotification(ASender: TObject;
  const a_sReportId: WideString; var a_asOrderIds, a_psExamIds: OleVariant;
  a_bSucceeded: WordBool);
begin

The a_asOrderIds show as Variant Array of uknown.

How do I get to the values inside a_asOrderIds?

peterviauAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dagan HooverDeveloperCommented:
You might want to use VarCast()/VarCastOLE()/VariantToDynArrat()

VarToDynArray: procedure(var DynArray: Pointer; const V: Variant; TypeInfo: Pointer);
VarCast: procedure(var Dest: Variant; const Source: Variant; VarType: Integer);
VarCastOle: procedure(var Dest: Variant; const Source: Variant; VarType: Integer);

So something like(I have never actually tryed this):

var VAOrderIDS Array of String

VarToDynArray(@VAOrderIDS,a_asOrderIds);

Then access VAOrderIDS.

This is all in theory of course.


0
peterviauAuthor Commented:
Unfortunatly VarToDynArray is a free pascal function call, I did not find anything like it in Delphi.
0
Dagan HooverDeveloperCommented:
Include Variants in your uses. I found it in delphi 7.
0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

ziolkoCommented:
ry this:

  if VarIsArray(a_asOrderIds) then
    for cnt := VarArrayLowBound(a_asOrderIds, 1) to VarArrayHighBound(a_asOrderIds, 1) do
      s := s + VarToStr(a_asOrderIds[cnt]);
  ShowMessage(s);


ziolko.
0
peterviauAuthor Commented:
I ended up switching to Delphi .net, it allowed em to use array of string.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.