可以参阅API函数:GetWindowLong, GetClassName, SetWindowText, ...

解决方案 »

  1.   

    如果是当前进程的
    用function FindControl(Handle: HWnd): TWinControl;如果不是
    那么就用
    SetWindowText那类的了
      

  2.   

    给你一段例程参考:
    function EnumWindowsProc(AHWnd: HWnd;  LPARAM: lParam): boolean; stdcall;
    var
      WndCaption: array[0..254] of char;
      WndClassName: array[0..254] of char;
      rtscreen: trect;
      WinXY:TRect;
      xy:TPoint;
    begin
      GetWindowText(AHWnd, @WndCaption, 254);
      GetClassName(AHWnd, @WndClassName, 254);
      if (pos('CashSurfers.com',wndcaption)<>0) then //用你已知的窗口标题替换这里, 找到此窗口
        begin
          ahwnd:=findwindowEX(ahwnd,0,pchar('TButton'),pchar('Cool!'));  // 找到窗口上的按钮
          GetWindowRect(AHWnd,WinXY);                                    // 得到按钮的坐标范围
          xy:=WinXY.TopLeft;                                             // 取得按钮左上角的坐标
          xy.x:=xy.x+10;
          xy.y:=xy.y+10;
          SetCursorPos(xy.x,xy.y);                                       // 将Mouse定位到按钮上
          Mouse_Event(MOUSEEVENTF_LEFTDown,xy.x,xy.y,0,0);               // 按下左键
          Mouse_Event(MOUSEEVENTF_LEFTUP,  xy.x,xy.y,0,0);               // 按下右键
        end;
      Result := True ;
    end;
      

  3.   

    其实有了handle就已经可以干很多事了
    关键是API的选择
    如楼上所说的及
    SetWindowLong等
      

  4.   

    没错只要有了handle,可以说想做什么就可以做什么了。
    关键就是找到做这个用的API。