Here is the VB Code I have:
Example PB Code
When running this code, I get the following message Boxes:
"Powerbasic - Start"
"lbound: 1"
"ubound: 3000"
with the message box "First Element:" I get a crazy number which makes no sense
when I do a messagebox Employee(1).SSN I get a random number
Any ideas?
Thanks
------------------
-Greg
Code:
Public Declare Function PerVac Lib "VacPer.dll" Alias "PERVAC" (Employee() As EmployeeStruct) As Long Type PeriodStruct Jan As Long Feb As Long Mar As Long Apr As Long May As Long Jun As Long Jul As Long Aug As Long Sep As Long Oct As Long Nov As Long Dec As Long End Type Type EmployeeStruct SSN As String * 9 PersonalEarned As PeriodStruct PersonalUsed As PeriodStruct VacationEarned As PeriodStruct VacationUsed As PeriodStruct End Type .. sub TEST() Dim Employee(1 To 3000) As EmployeeStruct Employee(1).SSN = "123456789" a& = PerVac(Employee()) Debug.Print Employee(1).SSN Debug.Print Employee(2).SSN end sub
Code:
#compile dll "C:\winnt\system32\vacper.dll" #INCLUDE "C:\PBDLL60\Samples\Vb32\VBAPI32.INC" TYPE PeriodStruct DWORD Jan AS LONG Feb AS LONG Mar AS LONG Apr AS LONG May AS LONG Jun AS LONG Jul AS LONG Aug AS LONG Sep AS LONG Oct AS LONG Nov AS LONG Dec AS LONG END TYPE TYPE EmployeeStruct DWORD SSN AS STRING * 9 PersonalEarned AS PeriodStruct PersonalUsed AS PeriodStruct VacationEarned AS PeriodStruct VacationUsed AS PeriodStruct END TYPE FUNCTION PerVac(Info AS DWORD) EXPORT AS LONG msgbox "Start" LOCAL l AS LONG LOCAL u AS LONG LOCAL vb AS DWORD l = vbArrayLBound(Info, 1) u = vbArrayUBound(Info, 1) vb = vbArrayFirstElem(Info) DIM Employee(1 TO u) AS EmployeeStruct AT vb MSGBOX "lBound: " & STR$(l) MSGBOX "ubound: " & STR$(u) MSGBOX "First Elem: " & STR$(vb) MSGBOX Employee(1).SSN end function
"Powerbasic - Start"
"lbound: 1"
"ubound: 3000"
with the message box "First Element:" I get a crazy number which makes no sense
when I do a messagebox Employee(1).SSN I get a random number
Any ideas?
Thanks
------------------
-Greg
Comment