General information
Category:
COM/DCOM and OLE Automation
Title:
Retrieving safearray BSTR** value from COM call in VFP
I can't figure out how to get the right return values of a a COM object from Visual Foxpro 7.0 SP1. I'm using Quickbooks 2003 Pro with Quickbooks SDK 2.1.
Here's Intuit's description of the COM method:
-------------------------------------------------
HRESULT QBXMLVersionsForSession([in] BSTR ticket,
[out, retval] SAFEARRAY (BSTR)** ppsa);
Returns an array containing the version numbers of the DTDs supported by the Request Processor. Note that this information may be different from the information returned by a Host Query request, as described in the Concepts Manual. HostQuery returns the complete list of all qbXML versions supported by the currently open connection, which is usually the information your application will require.
Parameters
ticket
Handle for this session (returned by BeginSession).
ppsa
Address of a variable to receive a pointer to an array of binary strings that specify the versions of the qbXML specification that are supported by the QuickBooks Request Processor. For example, the array contains 1.0, 1.1, 2.0, and 2.1 if your application is using the Request Processor from the latest version of QuickBooks, U.S. edition. It contains "CA2.0" if it is using the Request Processor from the Canadian edition of QuickBooks version 2.0.
--------------------------------------------------
I'm not real familiar with visual basic, but here's some code from the hostqueryinformation vb example that seems to work. The problem is I need to do this in VFP not VB.
-----VB CODE-------------------------------------------------------
Dim strVersions() As String
Dim strAllVersions As String
strVersions = qbXMLCOM.QBXMLVersionsForSession(strTicket)
strAllVersions = strVersions(LBound(strVersions))
If LBound(strVersions) < UBound(strVersions) Then
For i = LBound(strVersions) + 1 To UBound(strVersions)
strAllVersions = strAllVersions & " , " & strVersions(i)
Next
End If
--------------------------------------------------------------------------
The problem is that I need to do this from Visual Foxpro 7.0 SP1, which does not have support for arrays that are anything but 1 based. I've tried to call this using this code
dimension testarray[50]
testarray[1]="nothing in this array"
* then I try this and there is no error but nothing is placed into allversions
loQb.QBXMLVersionsForSession(lcticket,@allversions)
? allversions[1]
? allversions[2]
* or I try this and there is no error but nothing is placed into allversions
loQb.QBXMLVersionsForSession(lcticket,allversions)
? allversions[1]
? allversions[2]
Thanks in advance for any ideas any of you might have.
From: Ed
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only