Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

1/3 lines of JS or VBA to C++? (VBA class to C++)

Status
Not open for further replies.

Ingmar22

Technical User
Nov 9, 2010
2
DE
I have to call a function of an existing application via OLE automation.
The description of this function is as follows:

VARIANT GetItemCount( VARIANT outCountObj)
outCountObj : Specify the receive object for Count.

Sample code:
In JavaScript:
var Obj = { "count" : 0}; // How to do in C++?
var Ret = CMS100w.GetListCount(Obj);
var ListCount = Obj.count;

In VBA:
<Define of Class object>
CountObj
Public count as Integer // Looks easy, but ...
<Code>
Dim obj as CountObj // obj is VARIANT in C++
Set obj = New CountObj // Looks easy, but ...
Ret = CMS100w.GetListCount( obj)
ListCount = obj.count

My main problem is, that obj is not just a simple VARIANT.

So far I haven't found a way to fill the VARIANT outCountObj correctly in C++.
Does anybody know, what the VARTYPE of outCountObj has to be? (VT_DISPATCH?)
And how to fill the VARIANT correctly?
How to create the right VARIANT?

Any help appreciated!

Thank you in advance!

Ingmar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top