Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
UDT to STRING (and vice-versa) problem
Message
Information générale
Forum:
Visual Basic
Catégorie:
Autre
Titre:
UDT to STRING (and vice-versa) problem
Divers
Thread ID:
00138940
Message ID:
00138940
Vues:
59
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform