We (urgently) need to know if this will work..
This seems a solution to make use of dynamic string in a struct.
As long the VarPtr and StrPtr not go out of scope, PB seems to keep the data present.
Is this true??
Now we don't need HeapAlloc.
We need memory pointers where we can make use of Instr()
Thanks,
------------------
[email protected]
This seems a solution to make use of dynamic string in a struct.
As long the VarPtr and StrPtr not go out of scope, PB seems to keep the data present.
Is this true??
Now we don't need HeapAlloc.
We need memory pointers where we can make use of Instr()
Thanks,
Code:
#Compile Exe #Include "win32api.inc" Type DynamicString v As Dword '// VarPtr for maintenance s As String Ptr '// StrPtr to actual data End Type '// Custom struct. Type MyStruct MyString As DynamicString OtherData As Long End Type '// Be sure you keep the Varptr's and StrPtr's in scope! '// Otherwise PB will destroy your data. Global SP() As MyStruct Function SPTest() As Long Dim T As String Ptr T = SP( 1 ).MyString.s @T = Time$ & ", " & Date$ & ", " & Date$ & ", " & Date$ & ", " & Date$ & ", " & Date$ & ", " & Date$ & ", " & Date$ End Function Function PbMain ReDim SP( 1 To 2 ) SP( 1 ).MyString.s = VarPtr( SP( 1 ).MyString.v ) SP( 1 )[email protected] = "This is a test" MsgBox SP( 1 )[email protected] SPTest MsgBox SP( 1 )[email protected] End Function
------------------
[email protected]
Comment