Date: 02-16-2022
Return to Index
created by gbSnippets
'Compilable Example: (Jose Includes)
#Compile Exe
#Dim All
#Include "Win32API.inc"
Type PatientRecord
name As String * 14
age As Long
married As Long
End Type
Function PBMain() As Long
Local T As PatientRecord
Dim V(SizeOf(T)) As String*1 At VarPtr(T.name) 'DIM..AT a string#1 array to the first element of the UDT
Parse GetPatientRecord, V(), Chr$(255) 'TestFunction returns a string containing the UDT
? T.name + $CrLf + Str$(T.age) + $CrLf + IIf$(T.married,"Yes","No")
End Function
Function GetPatientRecord() As String
Local R As PatientRecord
Dim S(SizeOf(R)) As String*1 At VarPtr(R.name) 'DIM..AT a string*1 array to the first element of the UDT
R.name = "Eric Pearson"
R.age = 31
R.married = 1
Function = Join$(S(),Chr$(255)) 'pass the joined array elements with an unused delimiter between each element
End Function
'gbs_01382
'Date: 10-17-2014
http://www.garybeene.com/sw/gbsnippets.htm