Ok I'm lost, I'm tring to pass a pointer for a UDT from VB to pb6
then send it to an I/O port a byte at a time. This code will not
compile but it will if i pass a VARPRT of a string from VB (changing
some of the code of course). The problem is value = @t2. I thought, and
I'm wrong, that @t2 would be a pointer the the first byte of the
structure.
'pb code:
#COMPILE DLL "c:\windows\system\port32.dll"
'#INCLUDE "win32api.inc"
TYPE myType1
t1mytype2 AS LONG
END TYPE
TYPE myType2
testInt AS INTEGER
testUDT AS myType1
testLong AS LONG
END TYPE
SUB PBOUT(BYVAL PT AS INTEGER, StAddress AS DWORD) EXPORT
DIM t2 AS myType2 PTR
t2 = StAddress
DIM i AS LONG
DIM value AS BYTE
FOR i = 0 TO LEN(myType2)
value = @t2
! mov AL, value
! mov DX, PT
! out DX, AL
INCR t2
MSGBOX HEX$(value)
NEXT i
END SUB
FUNCTION PBINP(BYVAL PT AS INTEGER) EXPORT AS LONG
! mov DX, PT
! in AL, DX
! mov FUNCTION[0], AL
END FUNCTION
'VB Code:
Type myType1
t1mytype2 As Long
End Type
Type myType2
testInt As Integer
testUDT As myType1
testLong As Long
End Type
Declare Sub PBOUT Lib "port32.dll" (pt As Integer, mtype As myType2)
Dim t1 As myType1
Dim t2 As myType2
Private Sub Command1_Click()
t1.t1mytype2 = &HFFFFFFFF
t2.testInt = &HFFFF
t2.testLong = &HFFFFFFFF
PBOUT 300, t2
End Sub
Private Sub Command2_Click()
End
End Sub
then send it to an I/O port a byte at a time. This code will not
compile but it will if i pass a VARPRT of a string from VB (changing
some of the code of course). The problem is value = @t2. I thought, and
I'm wrong, that @t2 would be a pointer the the first byte of the
structure.
'pb code:
#COMPILE DLL "c:\windows\system\port32.dll"
'#INCLUDE "win32api.inc"
TYPE myType1
t1mytype2 AS LONG
END TYPE
TYPE myType2
testInt AS INTEGER
testUDT AS myType1
testLong AS LONG
END TYPE
SUB PBOUT(BYVAL PT AS INTEGER, StAddress AS DWORD) EXPORT
DIM t2 AS myType2 PTR
t2 = StAddress
DIM i AS LONG
DIM value AS BYTE
FOR i = 0 TO LEN(myType2)
value = @t2
! mov AL, value
! mov DX, PT
! out DX, AL
INCR t2
MSGBOX HEX$(value)
NEXT i
END SUB
FUNCTION PBINP(BYVAL PT AS INTEGER) EXPORT AS LONG
! mov DX, PT
! in AL, DX
! mov FUNCTION[0], AL
END FUNCTION
'VB Code:
Type myType1
t1mytype2 As Long
End Type
Type myType2
testInt As Integer
testUDT As myType1
testLong As Long
End Type
Declare Sub PBOUT Lib "port32.dll" (pt As Integer, mtype As myType2)
Dim t1 As myType1
Dim t2 As myType2
Private Sub Command1_Click()
t1.t1mytype2 = &HFFFFFFFF
t2.testInt = &HFFFF
t2.testLong = &HFFFFFFFF
PBOUT 300, t2
End Sub
Private Sub Command2_Click()
End
End Sub
Comment