When I run the code below, the Init populates the Tables array of user type TableType correctly.
But the Open routine doesn't display the correct information when accessing the same array again. The strings seems to 'run' into each other.
However, removing the two LONGs from TableType works. Any suggestions? I think this is a bug. Code seems simple enough to me.
These are the results I am getting for Tables.Filename when the LONGs are in the type declaration...
Tables(1).Filename "TABLE 1TABLE 2TABLE 3TABLE 4TABLE 5"
Tables(2).Filename "TABLE 2TABLE 3TABLE 4TABLE 5"
Tables(3).Filename "TABLE 3TABLE 4TABLE 5"
Tables(4).Filename "TABLE 4TABLE 5"
Tables(5).Filename "TABLE 5"
And when I removed the two LONGS from the TableType definition these are my results...they are as I would have expected.
Tables(1).Filename "TABLE 1"
Tables(2).Filename "TABLE 2"
Tables(3).Filename "TABLE 3"
Tables(4).Filename "TABLE 4"
Tables(5).Filename "TABLE 5"
Thanks,
Jeff
----------------------------------------------------------
#REGISTER ALL
#COMPILE DLL
#DIM ALL
#INCLUDE "WIN32API.INC"
#INCLUDE "VBAPI32.INC"
TYPE TableType
TableName as String * 70
FileName as String * 8
LKFileHandle as Long
OVFileHandle as Long
END TYPE
Global Tables() as TableType
Global TotalTables as Long
FUNCTION rvInit () EXPORT AS INTEGER
Dim Temp as Long
TotalTables = 0
FOR Temp = 1 to 5
INCR TotalTables
ReDim Preserve Tables(1 TO TotalTables)
Tables(TotalTables).TableName = "TABLE " + str$(TotalTables)
Tables(TotalTables).FileName = "BLAH"
Tables(TotalTables).LKFileHandle = 0
Tables(TotalTables).OVFileHandle = 0
msgbox Tables(TotalTables).TableName, , "DEBUG"
NEXT
rvInit = -1 ' success
END FUNCTION
FUNCTION rvOpen () EXPORT AS INTEGER
Dim ThisTable as Long
For ThisTable = 1 to TotalTables
msgbox Tables(ThisTable).TableName, , "DEBUG"
Next
rvOpen = -1 'success
END FUNCTION
------------------
But the Open routine doesn't display the correct information when accessing the same array again. The strings seems to 'run' into each other.
However, removing the two LONGs from TableType works. Any suggestions? I think this is a bug. Code seems simple enough to me.
These are the results I am getting for Tables.Filename when the LONGs are in the type declaration...
Tables(1).Filename "TABLE 1TABLE 2TABLE 3TABLE 4TABLE 5"
Tables(2).Filename "TABLE 2TABLE 3TABLE 4TABLE 5"
Tables(3).Filename "TABLE 3TABLE 4TABLE 5"
Tables(4).Filename "TABLE 4TABLE 5"
Tables(5).Filename "TABLE 5"
And when I removed the two LONGS from the TableType definition these are my results...they are as I would have expected.
Tables(1).Filename "TABLE 1"
Tables(2).Filename "TABLE 2"
Tables(3).Filename "TABLE 3"
Tables(4).Filename "TABLE 4"
Tables(5).Filename "TABLE 5"
Thanks,
Jeff
----------------------------------------------------------
#REGISTER ALL
#COMPILE DLL
#DIM ALL
#INCLUDE "WIN32API.INC"
#INCLUDE "VBAPI32.INC"
TYPE TableType
TableName as String * 70
FileName as String * 8
LKFileHandle as Long
OVFileHandle as Long
END TYPE
Global Tables() as TableType
Global TotalTables as Long
FUNCTION rvInit () EXPORT AS INTEGER
Dim Temp as Long
TotalTables = 0
FOR Temp = 1 to 5
INCR TotalTables
ReDim Preserve Tables(1 TO TotalTables)
Tables(TotalTables).TableName = "TABLE " + str$(TotalTables)
Tables(TotalTables).FileName = "BLAH"
Tables(TotalTables).LKFileHandle = 0
Tables(TotalTables).OVFileHandle = 0
msgbox Tables(TotalTables).TableName, , "DEBUG"
NEXT
rvInit = -1 ' success
END FUNCTION
FUNCTION rvOpen () EXPORT AS INTEGER
Dim ThisTable as Long
For ThisTable = 1 to TotalTables
msgbox Tables(ThisTable).TableName, , "DEBUG"
Next
rvOpen = -1 'success
END FUNCTION
------------------
Comment