The WindowFromPoint function retrieves the handle of the window that contains the specified point. HWND WindowFromPoint( POINT Point // structure with point ); ParametersPointSpecifies a POINT structure that defines the point to be checked. Return ValuesIf the function succeeds, the return value is the handle of the window that contains the point. If no window exists at the given point, the return value is NULL. ResThe WindowFromPoint function does not retrieve the handle of a hidden or disabled window, even if the point is within the window. An application should use the ChildWindowFromPoint function for a nonrestrictive search. See AlsoChildWindowFromPoint, POINT, WindowFromDC
The WindowFromPoint function retrieves the handle of the window that contains the specified point. HWND WindowFromPoint( POINT Point // structure with point
);
ParametersPointSpecifies a POINT structure that defines the point to be checked. Return ValuesIf the function succeeds, the return value is the handle of the window that contains the point. If no window exists at the given point, the return value is NULL. ResThe WindowFromPoint function does not retrieve the handle of a hidden or disabled window, even if the point is within the window. An application should use the ChildWindowFromPoint function for a nonrestrictive search. See AlsoChildWindowFromPoint, POINT, WindowFromDC
Top
回复人: outer2000(天外流星) ( ) 信誉:105 2003-02-21 11:21:00 得分:0
procedure TForm1.Button4Click(Sender: TObject);
var
dd:Tpoint;
test:Thandle;
begin
GetCursorPos(dd);
test:=windowfrompoint(dd);
sendmessage(test,wm_settext,0,integer(pchar('dd')));
end;
回复人: ghyghost(著名关心CSDN结贴率爱国主义人士代表) ( ) 信誉:96 2003-02-21 11:28:00 得分:0
补充一下,在获取屏幕的坐标时应该转换一下clienttoscreen函数,,然后再显示,,,,
Top
回复人: fancier(OP&&(C/C++)) ( ) 信誉:100 2003-02-21 11:46:00 得分:0
如果是同个工程的窗体,你可以这样解决:
在edit所在的窗体,添加窗体的Caption属性,如下
private
{ Private declarations }
procedure SetText(AValue: string);
public
{ Public declarations }
property Caption: string Write SetText;
end;实现
procedure TForm1.SetText(AValue: string);
begin
edit1.Text:= AValue;
end;在点击的窗体中的代码如下:uses Unit1; //引用{$R *.dfm}procedure TForm2.FormClick(Sender: TObject);
begin
Form1.Caption:= Format('%d', [handle]);
end;
Top
回复人: ghyghost(著名关心CSDN结贴率爱国主义人士代表) ( ) 信誉:96 2003-02-21 12:24:00 得分:0
对了,,在windows中窗口的概念是很模糊的一个button也是一个windows这个楼主要注意一下,,,如果没有记错的话相关的函数是
clienttoscreen
screentoclient
getwindowtext
getwindow
wm_gettext消息
sendmessgae