消息处理问题 可以参阅API函数:GetWindowLong, GetClassName, SetWindowText, ... 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 如果是当前进程的用function FindControl(Handle: HWnd): TWinControl;如果不是那么就用SetWindowText那类的了 给你一段例程参考: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; 其实有了handle就已经可以干很多事了关键是API的选择如楼上所说的及SetWindowLong等 没错只要有了handle,可以说想做什么就可以做什么了。关键就是找到做这个用的API。 delphi三层无状态分段取数据 dxPSdxTLLnk.dcu是什么 很忙,很少来,冒个泡 如何将bmp文件转成ico文件 为什么会产生接收错误,真是郁闷死了!!! 一个传参数问题 如何設置動畫的背景為透明??? 我是Delphi新手,如何才能……,100相送 onenter和onexit事件有什么用??? I/O Error 6???????? 请问哪位有Delphi做的公告板源码? 还是不行啊~~~~~~~~~100分!
用function FindControl(Handle: HWnd): TWinControl;如果不是
那么就用
SetWindowText那类的了
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;
关键是API的选择
如楼上所说的及
SetWindowLong等
关键就是找到做这个用的API。