- 人气:
- 放大
- 缩小
- 二维码
- 赞赏
delphi WinAPI: GetTopWindow - 获取指定窗口的子窗口中最顶层的窗口句柄
WinAPI: GetTopWindow - 获取指定窗口的子窗口中最顶层的窗口句柄
//声明:
GetTopWindow(
hWnd: HWND; {指定的窗口句柄}
): HWND; {失败返回0; 成功返回最顶层的子窗口句柄}
这和用 GetWindow 函数使用 GW_CHILD 参数时应该是一样的, 测试一下:
var
h1,h2: HWND;
begin
h1 := GetTopWindow(GetDesktopWindow);
h2 := GetWindow(GetDesktopWindow, GW_CHILD);
ShowMessage(Format('%d,%d',[h1,h2])); {132540,132540}
end;