How do I use a Type coming from a PB DLL to VB
Announcement
Collapse
No announcement yet.
VB TYPE
Collapse
X
-
please be more specific.
if you want to pass long value you can do so without any problem
if it is going to btring see: http://www.powerbasic.com/support/pb...ead.php?t=1712
------------------
niraj bhatt
-
ie.
type prodinfo
qty as asciiz * 3
prodname as asciiz * 25
amt as asciiz * 12
end type
declare function parseemailfile lib "mailp.dll" (filespec as asciiz,pinfo() as prodinfo,pinfoqty as long) as string
local st as string
local pinfoqty as long
dim pinfo(1 to 100) as prodinfo
st = parseemailfile("telx.txt",pinfo(),pinfoqty) 'filename, pinfo() for unknown amount, and pinfoqty to know how many purchased)
msgbox pinfo(pinfoqty).qty
msgbox pinfo(pinfoqty).prodname
msgbox pinfo(pinfoqty).amt
originally posted by niraj bhatt:
please be more specific.
if you want to pass long value you can do so without any problem
if it is going to btring see: http://www.powerbasic.com/support/pb...ead.php?t=1712
------------------
Inv. Mark Nelson
Comment
-
Mark,
This may not be the best way but it's all I've found to get a pb/ddl UDT to VB
in pb:
Function GetUDTprt ()export as long
ptr& = varptr(myPbudt)
function = ptr&
end function
in VB:
Sub GetPbUDT ()
Ptr&= GetUDTprt() 'call pb
MoveMemory myVBudt, ptr&, bts 'windows API call
'bts ist the number of bytes in your udt
end sub
This works for me, hope it helps. If anybody know a beter faster way I'd like to know
Doug
------------------
[This message has been edited by Doug McDonald (edited February 11, 2000).]
Comment
-
Mark, as usual members here come to the rescue. Here's a simple app to pass a udt to VB6 from PB/DLL......All thanks to Fred Oxenby for showing me the light.
#COMPILE DLL "c:\temp\type.dll"
TYPE mtype DWORD
x1 AS LONG
s1 AS STRING * 8
END TYPE
GLOBAL mytype AS mtype
FUNCTION getUdt(mytype AS mtype) EXPORT AS LONG
mytype.x1 = &hff
mytype.s1 ="ABCDEFGH"
FUNCTION =1
END FUNCTION
VB:
Type mtype
x1 As Long
s1 As String * 8
End Type
Global mytype As mtype
Declare Function getUdt Lib "C:\temp\type.dll" Alias "GETUDT" (mytype As mtype) As Long
Private Sub Command1_Click()
x = getUdt(mytype)
Text1.Text = mytype.s1 & " " & Str$(mytype.x1)
End Sub
Say thanks to Fred
Doug
------------------
Comment
Comment