如何在 Windows 中获取 z 顺序? [英] How to get the z-order in windows?

查看:27
本文介绍了如何在 Windows 中获取 z 顺序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个应用程序,我可以在其中与每个正在运行的应用程序进行交互.现在,我需要一种获取窗口 z 顺序的方法.例如,如果 Firefox 和记事本正在运行,我需要知道哪个在前面.

I'm making an application where I interact with each running application. Right now, I need a way of getting the window's z-order. For instance, if Firefox and notepad are running, I need to know which one is in front.

有什么想法吗?除了为每个应用程序的主窗口执行此操作外,我还需要为其子窗口和姐妹窗口(属于同一进程的窗口)执行此操作.

Any ideas? Besides doing this for each application's main window I also need to do it for its child and sister windows (windows belonging to the same process).

推荐答案

您可以使用 GetTopWindow 函数搜索父窗口的所有子窗口,并返回 z 顺序最高的子窗口的句柄.GetNextWindow 函数按 z 顺序检索下一个或上一个窗口的句柄.

You can use the GetTopWindow function to search all child windows of a parent window and return a handle to the child window that is highest in z-order. The GetNextWindow function retrieves a handle to the next or previous window in z-order.

GetTopWindow:http://msdn.microsoft.com/en-us/library/ms633514(VS.85).aspx
GetNextWindow:http://msdn.microsoft.com/en-us/library/ms633509(VS.85).aspx

GetTopWindow: http://msdn.microsoft.com/en-us/library/ms633514(VS.85).aspx
GetNextWindow: http://msdn.microsoft.com/en-us/library/ms633509(VS.85).aspx

这篇关于如何在 Windows 中获取 z 顺序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆