Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
UDT to STRING (and vice-versa) problem
Message
General information
Forum:
Visual Basic
Category:
Other
Title:
UDT to STRING (and vice-versa) problem
Miscellaneous
Thread ID:
00138940
Message ID:
00138940
Views:
58
Hi,

I've tried your solution (code follows), but it doesn't work.

Is there a BUG in my module ? I don't find. Can you have a glance to it. THANKS.


Option Explicit

Type usrInFile
NumPost As String * 1
IdPs As String * 9
NumSce As String * 1
FileI As String * 40
FileO As String * 40
End Type

Private zInfile As usrInFile

Declare Sub CopyStringToUsr Lib "Kernel32" Alias "RtlMoveMemory" (pDest As Any, ByVal StrSrc As String, ByVal byteLen As Long)
Declare Sub CopyUsrToString Lib "Kernel32" Alias "RtlMoveMemory" (ByVal StrDest As String, pSrc As Any, ByVal byteLen As Long)

Function UsrToStr(Usr)
Dim Dest As String

Call CopyUsrToString(Dest, Usr, LenB(Usr))
UsrToStr = StrPtr(Dest)
End Function

Sub DispStrfromUDT()
Dim stri As String
Dim NumFile As Integer

NumFile = FreeFile

Open App.Path & "\In" For Binary As #NumFile
Get #NumFile, , zInfile
Close NumFile

stri = UsrToStr(VarPtr(zInfile))
MsgBox stri
End Sub
Sub main()
DispStrfromUDT
End Sub
VB Developer
Servilog Concept
jmb@octalfrance.com
Next
Reply
Map
View

Click here to load this message in the networking platform