您的位置:首页 > 百科 > 正文

MoveMemory

MoveMemory复制内存。

函数原型为voidMoveMemory(来自PVOID Destination, const VOID*Source, SIZE_T Length)。

  • 外文名称 MoveMemory
  • Destination 目的数据的地址
  • Source 来源数据的地址
  • Length 复制数据的字节数

函数参数

  Mo家国青关款告升色季veMemory来自各参数意义:

  (1360百科)Destination:目的数据的地址;

  (2)Source:来源数据的地址;

  (3)Length:复制钟胞数据的字节数。

应用举例

  使用实例:

  var rect剂矛今措1,RECT2:TRect;

  begin

 针点航指选今 rect1.Left:=10;

  rect色服1.Top:=10;

  rect1.Bottom:=200;

  rect1.Right:=200;

部粮它映  rect2.Left:=50;

  rect2.top:=100;

  rect2.Bottom:=400;

  rect2.Right:=390;

  form1.Can煤阿vas.FillRect(re找苗语得开星细油严委管ct1);

  showmessage('movemory!');

  form1.Refresh;

  windows.MoveMemory(@rect1,@rect2,sizeof(TRect));

  form1.Canvas.Fi探湖保核苏十口立古流复llRect(rect1);

  结果把rect责劳举溶改造红核景乐先2的值赋到rect1中

  移动数组的值

  一般的办法:

  v历城鸡刘屋报ar s1,s2:array[0..4] of integer;

  i:integer;

  begin

  s候布至行距听洋委眼初1[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 :

  Declare Sub MoveMemory Lib "kernel32" Alias "RtlMoveMemory" (pDest As Any, pSource As Any, ByVal dwLength As Long)

  'MoveMemory(pDest As Any, pSource As Any, ByVal dwLength As Long)

  'MoveMemory参数意义:

  '(1)pDest:目的数据的地址;

  '(2)pSource:来源数据的地址;

  '(3)dwLength:数据的字节数;

发表评论

评论列表