http://www.thinbasic.com/community/s...5317#post85317
here's a little example for using "byref" + "strptr"
' Empty GUI script created on 11-16-2011 10:24:41 by largo_winch (ThinAIR)
' Empty GUI script created on 11-15-2011 23:44:20 by largo_winch (ThinAIR)
Uses "console"
Declare Sub CopyMemory Lib "kernel32.dll" Alias "RtlMoveMemory" ( _
ByRef pDst As Any, _
ByRef pSrc As Any, _
ByVal ByteLen As Long)
'---------------->
Sub myexample()
'---------------->
Const TEST_TEXT As String = "Hello Largo "
Dim strString As String
Dim lngCounter As Long, lngPosition As Long
strString = $SPC(50 * Len(TEST_TEXT))
For lngCounter = 1 To 50
Call CopyMemory(ByVal StrPtr(strString) + lngPosition, _
ByVal StrPtr(TEST_TEXT), Len(TEST_TEXT) )
lngPosition = lngPosition + Len(TEST_TEXT)
Next
PrintL strString
PrintL test_text
End Sub
PrintL myexample()
PrintL
PrintL "push a key to exit example"
WaitKey
'-------------------------------------------->
'-----------------> but take attention: new win api (winNT include file) using other declare statements ------------------------------>
'Declare Sub CopyMemory Lib "KERNEL32.DLL" Alias "RtlMoveMemory" ( _
' ByVal Destination As DWord _ ' __in PVOID Destination
' , ByVal Source As DWord _ ' __in const VOID* Source
' , ByVal Length As DWord _ ' __in SIZE_T Length
' ) ' void
'------------------------------------------------------------------------------------>
bye, largo
Bookmarks