Click to See Complete Forum and Search --> : Copy Memory


Bin
November 15th, 1999, 11:41 PM
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.

Francois
November 16th, 1999, 02:36 AM
Try with fixed length string

Lothar Haensler
November 16th, 1999, 02:42 AM
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