|
|
|
Here's the correct declaration of the CopyMemory API function, which is so useful whenever you want to move a block of bytes between two memory locations: |
You should be aware of a few caveats of this statement:
When the source or the destination is a Visual Basic variable, it should be passed by reference, for example: ' copy an Integer into the low word of a Long variable CopyMemory lngValue, intValue, 2
When the source or the destination is a memory locationyou should pass a 32-bit address by value, for example: |
When the source or the destination is an array of numbers (or of UDTs that contains only numeric and fixed-length strings), you must pass the first element of the array by reference: |
Passing zero as the last arguments crashes the application, therefore when the number of bytes to be transferred is dynamically evalutated at runtime, you should always check that it isn't a null value, as in: |
|
|
|
Submitted By :
Nayan Patel
(Member Since : 5/26/2004 12:23:06 PM)
|
|
|
Job Description :
He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting. |
View all (893) submissions by this author
(Birth Date : 7/14/1981 ) |
|
|