Home > Software engineering >  Consult a memory copy of the problem..
Consult a memory copy of the problem..

Time:10-09

VB:
CopyMemory is RtlMoveMemory function
The count=3000;
"Count=5000;
CopyMemory ByVal VarPtr (0), (b), ByVal VarPtr (count)), 1
CopyMemory ByVal VarPtr (1) (b), ByVal VarPtr (count)) + 1, 1
CopyMemory ByVal VarPtr (2) (b), ByVal VarPtr (count)) + 2, 1
CopyMemory ByVal VarPtr (b) (3), ByVal VarPtr (count)) + 3, 1

'the conversion results:
'3000 - & gt; 00 80 45
3 b'5000 - & gt; 00 forty nine 45 c


Why is there such result? Can help to explain the principle of specific?

CodePudding user response:

You are the type of the variable count is wrong!
Not Long, are variant!

CodePudding user response:

Should Count as LS said, you are the Variant, if it is should be like this:
CopyMemory ByVal VarPtr (0), (b), ByVal VarPtr (count)) + 8, 1
CopyMemory ByVal VarPtr (1) (b), ByVal VarPtr (count)) + 9, 1
CopyMemory ByVal VarPtr (2) (b), ByVal VarPtr (count)) + 10, 1
CopyMemory ByVal VarPtr (b) (3), ByVal VarPtr) + 11, 1 (count)

CodePudding user response:

You should understand or UDT is stored in a memory in the array. Suggest research SAFEARRAY.

CodePudding user response:

Big XXX
Little XXX
The problem of word order, forgot how the noun called

  •  Tags:  
  • API
  • Related