MoveMemory
计算机函数
MoveMemory复制内存。
函数参数
MoveMemory各参数意义:
(1)Destination:目的数据的地址;
(2)Source:来源数据的地址;
(3)Length:复制数据的字节数。
应用举例
使用实例:
var rect1,RECT2:TRect;
begin
rect1.Left:=10;
rect1.Top:=10;
rect1.Bottom:=200;
rect1.Right:=200;
rect2.Left:=50;
rect2.top:=100;
rect2.Bottom:=400;
rect2.Right:=390;
form1.Canvas.FillRect(rect1);
showmessage('movemory!');
form1.Refresh;
windows.MoveMemory(@rect1,@rect2,sizeof(TRect));
form1.Canvas.FillRect(rect1);
结果把rect2的值赋到rect1中
移动数组的值
一般的办法:
var s1,s2:array[0..4] of integer;
i:integer;
begin
s1[0]:=1;
s1[1]:=2;
s1[2]:=3;
s1[3]:=4;
s1[4]:=5;
s2[0]:=6;
s2[1]:=7;
s2[2]:=8;
s2[3]:=9;
s2[4]:=0;
for a:=0 to 4 do s1[a]:=s2[a];
end;
用movemeory的办法:
var s1,s2:array[0..4] of integer;
i:integer;
begin
s1[0]:=1;
s1[1]:=2;
s1[2]:=3;
s1[3]:=4;
s1[4]:=5;
s2[0]:=6;
s2[1]:=7;
s2[2]:=8;
s2[3]:=9;
s2[4]:=0;
for i:=0 to 4 do showmessage('s1的'+inttostr(i)+':'+inttostr(s1[i]));
showmessage('movemeory1!');
windows.MoveMemory(@s1,@s2,sizeof(s1));
for i:=0 to 4 do showmessage('s1的'+inttostr(i)+':'+inttostr(s1[i]));
VB :
'MoveMemory(pDest As Any, pSource As Any, ByVal dwLength As Long)
'MoveMemory参数意义:
'(1)pDest:目的数据的地址;
'(2)pSource:来源数据的地址;
'(3)dwLength:数据的字节数;
参考资料
最新修订时间:2024-12-27 10:23
目录
概述
函数参数
应用举例
参考资料