06.02.2024, 16:41
Guten Tag
Leider geht das jetzt auch nicht mehr mit 64-bit/Windows 11.00. Der Fehler ist dieses VarPtr. Gibt es hier auch eine andere Lösung für CopyMemory? Vielen Dank für Eure Hilfe.
Gruss
Stefan
Public Declare PtrSafe Sub CopyMemory Lib "kernel32.dll" Alias "RtlMoveMemory" (ByRef Destination As Any, ByRef Source As Any, ByVal Length As LongPtr)
Public Function Append(Value As String) As clsStringBuilder
Dim NewUBound As Long
Dim CapacityUBound As Long
On Error GoTo Failed
NewUBound = mUBound + LenB(Value)
If NewUBound > UBound(mString) Then
CapacityUBound = UBound(mString) * 2 + 1
If NewUBound > CapacityUBound Then CapacityUBound = NewUBound * 2 + 1
ReDim Preserve mString(0 To CapacityUBound)
End If
CopyMemory VarPtr(mString(mUBound + 1)), StrPtr(Value), LenB(Value)
mUBound = NewUBound
Set Append = Me
Exit Function
Failed:
Stop
Resume
End Function
Leider geht das jetzt auch nicht mehr mit 64-bit/Windows 11.00. Der Fehler ist dieses VarPtr. Gibt es hier auch eine andere Lösung für CopyMemory? Vielen Dank für Eure Hilfe.
Gruss
Stefan
Public Declare PtrSafe Sub CopyMemory Lib "kernel32.dll" Alias "RtlMoveMemory" (ByRef Destination As Any, ByRef Source As Any, ByVal Length As LongPtr)
Public Function Append(Value As String) As clsStringBuilder
Dim NewUBound As Long
Dim CapacityUBound As Long
On Error GoTo Failed
NewUBound = mUBound + LenB(Value)
If NewUBound > UBound(mString) Then
CapacityUBound = UBound(mString) * 2 + 1
If NewUBound > CapacityUBound Then CapacityUBound = NewUBound * 2 + 1
ReDim Preserve mString(0 To CapacityUBound)
End If
CopyMemory VarPtr(mString(mUBound + 1)), StrPtr(Value), LenB(Value)
mUBound = NewUBound
Set Append = Me
Exit Function
Failed:
Stop
Resume
End Function