当编辑框有多个时如何获取hWnd?
我有一个不属于我的程序,它有 3 个 TEdit 框和 3 个 TButton 对象。我可以通过使用轻松获取按钮句柄:
IntPtr buttonhwnd = FindWindowEx(mainhwnd, IntPtr.Zero, "TButton", "Button Text");
但我无法对编辑框执行相同的操作,因为它们中没有任何文本。因此 FindWindowEx(hWnd, IntPtr.Zero, "TEdit", "")
可以获取所有这些。然而,它只得到它遇到的第一个,而我需要最后一个。有没有办法跳过多个框或区分它们?
I have a program that is not mine that has 3 TEdit boxes and 3 TButton objects. I can easily get the button handles by using:
IntPtr buttonhwnd = FindWindowEx(mainhwnd, IntPtr.Zero, "TButton", "Button Text");
But I can't do the same with the Edit boxes since they don't have any text in them. Therefore FindWindowEx(hWnd, IntPtr.Zero, "TEdit", "")
can get all of them. However, it only gets the first one it comes across and I need the last one. Is there a way to skip a number of boxes or differentiate between them?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找到了答案:
鉴于有 3 个控件,我可以使用:
虽然不是动态的,但它可以为我完成工作。然而,为了将来可能需要这个的人参考:除了知道他们所处的 Z 位置之外,还有什么方法可以区分他们吗?
I found the answer:
Given there are 3 controls, I can use:
Although not dynamic, it gets the job done for me. However, for future reference for people who might need this: Is there a way to differentiate between them besides knowing what Z position they're in?