- Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (pDst As Any, pSrc As Any, ByVal ByteLen As Long)
- ' Un type bidon
- Type tmpEx
- Ex1 As Long
- VBfrance As String
- Pe As Boolean
- MPP As Integer
- End Type
-
-
- Sub main()
- Dim t1 As tmpEx
- Dim t2 As tmpEx
- ' Initialise t1 avec des valeurs bidons
- With t1
- .Ex1 = 3465
- .VBfrance = "Codes-Sources"
- .Pe = True
- .MPP = -6954
- End With
- ' On copy la mémoire -> on copy t1 sur t2
- CopyMemory t2, t1, Len(t1)
-
- ' on voit le résultat
- With t2
- MsgBox "Ex1=" & .Ex1 & vbNewLine & _
- "VBFrance=" & .VBfrance & vbNewLine & _
- "Pe=" & .Pe & vbNewLine & _
- "MPP=" & .MPP, vbInformation, "Contenu de la copie t2"
- End With
- End Sub
-
Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (pDst As Any, pSrc As Any, ByVal ByteLen As Long)
' Un type bidon
Type tmpEx
Ex1 As Long
VBfrance As String
Pe As Boolean
MPP As Integer
End Type
Sub main()
Dim t1 As tmpEx
Dim t2 As tmpEx
' Initialise t1 avec des valeurs bidons
With t1
.Ex1 = 3465
.VBfrance = "Codes-Sources"
.Pe = True
.MPP = -6954
End With
' On copy la mémoire -> on copy t1 sur t2
CopyMemory t2, t1, Len(t1)
' on voit le résultat
With t2
MsgBox "Ex1=" & .Ex1 & vbNewLine & _
"VBFrance=" & .VBfrance & vbNewLine & _
"Pe=" & .Pe & vbNewLine & _
"MPP=" & .MPP, vbInformation, "Contenu de la copie t2"
End With
End Sub