?
Solved

VARIANT type

Posted on 2003-03-16
2
Medium Priority
?
380 Views
Last Modified: 2013-11-20
hi,

i need to pass in a VARIANT type to a function and i have no idea how to initialse the VARIANT type. how do i initalize the variant to contains an array of unsigned long?

thank you
0
Comment
Question by:xstar
[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 Comments
 
LVL 1

Accepted Solution

by:
vadik earned 150 total points
ID: 8146841
Try this way:

     VARIANT v;
     long arLong[10] = { 0 };

     VariantInit(&v); // Initialization of VARIANT

     v.vt = VT_BYREF | VT_I4; // Type of variant (pointer to long, long FAR * plVal;
     v.plVal = &arLong[0]; // Assignment

        SomeFunc(v); // void SomeFunc(VARIANT&)

     VariantClear(&v);
0
 
LVL 1

Expert Comment

by:Hermetic
ID: 8149077
Do you need a Variant of the type "array of longs"?
or
a Variant of type variant array of longs?
or
a variant of type variant array (safearray) of longs?

Did I mention I hate Variants?
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…

719 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