procedure TfmLook.Timer1Timer(Sender: TObject);
var 
  pPoint:TPoint;
  hWnd:Integer;
begin
  GetCursorPos(pPoint);
  hWnd:=WindowFromPoint(pPoint);
  
  SendMessage(hwnd,WM_MOVE,30,30);
end;为什么sendmessage不起作用啊?

解决方案 »

  1.   

    声明一个procedure WMMove(var Message: TWMMouse); message WM_MOVE;
    再去处理你的动作才对
      

  2.   

    如果要移动指定控件,可以这样
    const SC_DRAGMOVE:longint=$f012;
       ReleaseCapture;
       sendmessage(form1.Handle,wm_syscommand, SC_DRAGMOVE, 0);
      

  3.   

    procedure TForm1.Button1Click(Sender: TObject);
    begin
      MoveWindow(handle,10,10,height,width,true);
    end;
      

  4.   

    不用发送消息
    直接使用API函数原型:BOOL MoveWindow(HWND hWnd.int x.int y,int nWidth,int nHeight,BOOL BRePaint);
      

  5.   

    procedure  TForm1.Button1Click(Sender:  TObject);  
    begin  
       MoveWindow(handle,10,10,height,width,true);  
    end; ok,谢谢!