FindWindowEx - 如果有多个具有相同类名的文本框,则选择文本框
我想使用 SendMessage/PostMessage 将一些键发送到应用程序文本框。我使用 Microsoft Spyxx 来获取此文本框的类名。现在我遇到的问题是,此应用程序中有多个文本框具有相同的类名(“WindowsForms10.EDIT.app.0.2e0c681”)和相同的窗口名称。
如何获得合适的手柄?
PS:我正在使用 Visual c# 2008 express 使用 c# 进行编码
I want to use SendMessage/PostMessage to send some keys to an applications textbox. I used Microsoft Spyxx to get class name of this textbox. Now I have the problem that there are several textboxes in this app with the same class-Name ("WindowsForms10.EDIT.app.0.2e0c681") and same Window-name.
How to get the handle of the right one?
PS: I'm coding in c# with Visual c# 2008 express
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好吧,您必须了解一些关于可以使用的文本框的信息:例如,您可以搜索具有特定所有者的文本框,并检查前面的子窗口是什么...如果控件有标签,您可以首先找到标签,然后找到位于其右侧的控件。
Well, there must be something you do know about the textboxe that you could use: For instance you could search for a textbox with a specific owner, and check what the preceding child window is... If the control has a label, you could find the label first and then find the control sitting to the right of it.
如果不同的 hWnd 值返回相同的 API 函数结果,
您可能不得不根据对象在表单上存在的位置进行编辑
If the different hWnd values return the same results for the API functions
you may be stuck having to do your edits based in the position the objects exist on the form