Home
Up

In this page I published few Techniques in VB6 programming. Hope it would be useful for programmers. If you have any question please For E-mail assistance please Click Here.

String To Structure conversion in VB6

Dim MyString As string     'string definition

Private Type MyStructure_ 'structure definition
data1 As Integer
data2 as long
End Type

Dim MyStructure As MyStructure_  'defining new structure

Public Declare Sub StringToStructure Lib "kernel32" Alias "RtlMoveMemory" _
(ByRef DestStructure As Any, ByVal SrcString As Any, ByVal Length As Long)

if(Len(MyStructure)=Len(MyString)) then StringToStructure MyStructure, MyString, Len(MyStructure)

[Up]