General information
Category:
COM/DCOM and OLE Automation
Title:
Passing integer arrays to a COM server written in Visual Bas
Hi,
I am coding a wrapper for an application called LaserForms and have come across a problem. The PrintForm() method of LaserForms requires an array of type integer to be passed to it. Each element of the array contains an integer that contains a page number. LaserForms then processes this integer array and prints each page.
This is the demo code in Visual Basic ( this works):
Private Sub cmdPrint_Click()
Dim printRange() As Integer, i As Integer
ReDim printRange(1 To LFMApp.ActiveDocument.Pages.Count) As Integer
For i = 1 To LFMApp.ActiveDocument.Pages.Count
printRange(i) = i
Next
LFMApp.ActiveDocument.PrintForm printRange
End Sub
and this is my code in VFP (this does not work):
IF llSuccess
*-- Get the total number of pages
lnTotPages = loLFDoc.Pages.Count
DIMENSION laPageRange[ lnTotPages ] AS INTEGER
FOR lnPageCount = 1 TO lnTotPages
laPageRange[ lnPageCount ] = lnPageCount
ENDFOR
ENDIF
IF llSuccess
*-- Actually print the form
loLFDoc.PrintForm( laPageRange )
ENDIF
I have tried various ways of getting this to work e.g. hard coded values, passing by reference, removing the AS INTEGER etc and can not get the COM server to accept the values. I do not know what a VB array of integers looks like, presumably there is a small header with the type and number of elements in and then the data. Does anyone know? Does anyone know a way of passing this type of information from VFP?
Thanks!
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