Valhalla Legends Forums Archive | Battle.net Bot Development | CopyMemory with Visual Basic Express 2005

AuthorMessageTime
iNsaNe
In Visual Basic Express 2005,  declaring a parameter as 'Any' isn't allowed. How could I change this declaration..

[code]Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (ByRef Destination As Any, ByRef Source As Any, ByVal numbytes As Long)[/code]
March 6, 2007, 4:09 AM
Spilled[DW]
Never used 2005 but try this:

Public Declare Sub CopyMemory Lib "KERNEL32" Alias "RtlMoveMemory" (ByRef Destination As Object, ByRef Source As Object, ByVal Length As Short)
March 6, 2007, 4:21 AM
l2k-Shadow
[quote author=iNsaNe link=topic=16438.msg166330#msg166330 date=1173154144]
In Visual Basic Express 2005,  declaring a parameter as 'Any' isn't allowed. How could I change this declaration..

[code]Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (ByRef Destination As Any, ByRef Source As Any, ByVal numbytes As Long)[/code]
[/quote]
[code]
Public Declare Sub CopyMemoryToInt lib "kernel32" Alias "RtlMoveMemory" (ByRef Destination As Integer, ByRef Source As String, ByVal numbytes As Integer)

Public Declare Sub CopyMemoryToStr lib "kernel32" Alias "RtlMoveMemory" (ByRef Destination As String, ByRef Source As Integer, ByVal numbytes As Integer)
[/code]
March 6, 2007, 5:04 AM
iNsaNe
[quote author=l2k-Shadow link=topic=16438.msg166336#msg166336 date=1173157456]
[code]
Public Declare Sub CopyMemoryToInt lib "kernel32" Alias "RtlMoveMemory" (ByRef Destination As Integer, ByRef Source As String, ByVal numbytes As Integer)

Public Declare Sub CopyMemoryToStr lib "kernel32" Alias "RtlMoveMemory" (ByRef Destination As String, ByRef Source As Integer, ByVal numbytes As Integer)
[/code]
[/quote]

I'm kind of noob to this.. what would CopyMemoryToInt and CopyMemoryToStr be used for instead of just using CopyMemory
March 6, 2007, 5:07 AM
l2k-Shadow
[quote author=iNsaNe link=topic=16438.msg166337#msg166337 date=1173157652]
[quote author=l2k-Shadow link=topic=16438.msg166336#msg166336 date=1173157456]
[code]
Public Declare Sub CopyMemoryToInt lib "kernel32" Alias "RtlMoveMemory" (ByRef Destination As Integer, ByRef Source As String, ByVal numbytes As Integer)

Public Declare Sub CopyMemoryToStr lib "kernel32" Alias "RtlMoveMemory" (ByRef Destination As String, ByRef Source As Integer, ByVal numbytes As Integer)
[/code]
[/quote]

I'm kind of noob to this.. what would CopyMemoryToInt and CopyMemoryToStr be used for instead of just using CopyMemory
[/quote]

Look at the declarations of both and figure it out.

EDIT: In order to help you understand this, it's because in C++, the function is declared as memcpy(void*, const void*, size_t) so in VB noob terms: take void as something like Any in VB... but since VB.NET doesn't have Any, you have to specify which type of variable you'd like to copy into instead of just "Any variable I want at the time".
March 6, 2007, 5:08 AM
Myndfyr
Please see this thread.
March 6, 2007, 6:06 AM

Search