WinAPI: WindowFromPoint- 获取指定点所在窗口的句柄
2008-09-11 10:16
555 查看
WinAPI: WindowFromPoint- 获取指定点所在窗口的句柄
[/code]
[code]//声明: WindowFromPoint(Point: TPoint): HWND; //举例: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls; type TForm1 = class(TForm) Button1: TButton; Timer1: TTimer; procedure Timer1Timer(Sender: TObject); end; var Form1: TForm1; implementation {$R *.dfm} var h: HWND; procedure TForm1.Timer1Timer(Sender: TObject); var pt: TPoint; arr: array[0..254] of Char; begin if GetCursorPos(pt) then {如果能获取点} begin h := WindowFromPoint(pt); {返回句柄} GetClassName(h, arr, Length(arr)); {获取该句柄窗口的类名} Text := arr; {显示在标题} end; end; end.
[/code]
相关文章推荐
- WinAPI: WindowFromPoint- 获取指定点所在窗口的句柄
- WinAPI: WindowFromPoint- 获取指定点所在窗口的句柄
- WindowFromPoint -- 获得包含指定点的窗口的句柄
- 用WindowFromPoint()函数来获得鼠标所在位置的窗口的句柄--发生一个关闭窗口的消息---关闭鼠标所在的窗口
- WinAPI: GetTopWindow - 获取指定窗口的子窗口中最顶层的窗口句柄
- WinAPI: GetNextWindow - 获取指定窗口Z上或Z下的窗口的句柄
- WinAPI: GetNextWindow - 获取指定窗口Z上或Z下的窗口的句柄
- WinAPI: GetWindow - 获取与指定窗口具有指定关系的窗口的句柄
- 获取指定窗口句柄结束进程 OpenProcess FindWindow GetExitCodeprocess TerminateProcess
- 易语言-API 取窗口或者组件句柄的 屏幕坐标并限制区域 GetWindowRect ClipCursor getwindowrect GetClientRect WindowFromPoint
- WindowFromPoint -- 获得包括指定点的窗体的句柄
- WinAPI: GetWindow - 获取与指定窗口具有指定关系的窗口的句柄
- WinAPI: GetForegroundWindow - 获取前台窗口的句柄
- WinAPI: GetActiveWindow - 获取当前活动窗口的句柄
- VC2008获取指定的窗口句柄
- WinAPI: GetFocus - 获取当前拥有焦点的窗口的句柄
- [WinAPI] 获取窗口句柄的几种方法
- C#获取鼠标处的窗口(window)句柄
- WinAPI: GetParent - 获取指定窗口的父窗口句柄
- WinAPI: GetWindowThreadProcessId - 获取指定窗口的进程 ID 或线程 ID