-
Copy Memory
Hi,
I am using the API call CopyMemory in my code. It works fine when my source is of datatype long/int. But the program crashes when source is of any other data type like string.
Does this call accept only long data type, if yes can anybody hint me how to convert a string to long and then get this back.
------------------------------------------------------------------------
private Declare Sub CopyMemory Lib "Kernel32" Alias "RtlMoveMemory" (Destination as Any, Source as Any, byval Length as Long)
Your view on this issue will be of great help.
Cheers,
Bin.
-
Re: Copy Memory
Try with fixed length string
-
Re: Copy Memory
use the Byval keyword in your call as in:
Declare Sub CopyMemoryD Lib “KERNEL32” Alias “RtlMoveMemory” ( _ lpvDest as Any, lpvSource as Any, byval cbCopy as Long)
CopyMemoryD byval sDstD, byval sSrc, len(sSrc)
"stolen" from MSDN