Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Populating an in parameter array
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Populating an in parameter array
Miscellaneous
Thread ID:
00877468
Message ID:
00877468
Views:
58
Hi! I have to create a com object that receives an array as an in parameter and populates it. The syntax of the following function is as follows:

HRESULT GetSessions([in] long lClientID, [in] VARIANT vaSessions)

Precondition:
• vaSessions.vt must be either VT_ARRAY | VT_UNKNOWN or VT_ARRAY |
VT_DISPATCH.
• The SAFEARRAY contained in vaSessions must have exactly the same number of elements as
the client has sessions.

Postcondition:
• The SAFEARRAY in vaSessions will contain the ISession objects corresponding to the client’s sessions.

My function receives the array. However, I cannot populate it. It seems that the array's elements are objects but I cannot access them. When I try to set the array's elements to objects returned by the createObject function, they can be populated but the array returned is empty.

The functional spec contains the following note:
The vaSessions parameter is an [in] parameter. This conflicts with COM rules because data are returned in this parameter. However, due to the fact that the Database component is loaded inproc and not marshaled, this method works correctly.

The Note indicates that what I am trying to do is illegal but should work anyway. Is there something I need to do to make it work anyway? I am really stuck. Any help would be greatly appreciated.

Thanks,
Eylon
Next
Reply
Map
View

Click here to load this message in the networking platform