从另一个应用程序中的控件获取文本(Internet Explorer) [英] Get text from a control in another application (internet explorer)
本文介绍了从另一个应用程序中的控件获取文本(Internet Explorer)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经阅读了很多有关gettext和getwindowtext的文章.我可以获取Windows名称,但如何访问另一个应用程序中的控件并从文本框中提取文本?
I have been reading a lot about gettext and getwindowtext. I can get the windows name but how can I access a control in another application and extract text from a textbox?
推荐答案
使用 ^ ]找出如何获取ie控件的句柄-对于IE 9,它将具有一个名为"Internet Explorer_Server"-窗口类(已在 ^ ]),而不是.Net类名称-它不是Internet Explorer的顶级窗口.
如果WM_GETTEXT可与ie控件一起使用,但我会感到惊讶,但它会模拟
ctrl + a
ctrl + c
使用 SendKeys类 [
Use Spy ++[^] to figure out how to get the handle of the ie control - for IE 9 it will have a class named "Internet Explorer_Server" - that''s the window class (as registered with RegisterClassEx[^]), not the .Net class name - and it''s not the top level window for internet explorer.
I''d be surprised if WM_GETTEXT works with the ie control, but simulating
ctrl+a
ctrl+c
using the SendKeys class[^] will put the contents of the control on the clipboard.
Best regards
Espen Harlinn
此简单文章 [
This simple post[^] might help you out.
来自MSDN :
要在另一个进程中检索控件的文本,请直接发送WM_GETTEXT
消息,而不是调用GetWindowText
.
From MSDN:
To retrieve the text of a control in another process, send aWM_GETTEXT
message directly instead of callingGetWindowText
.
这篇关于从另一个应用程序中的控件获取文本(Internet Explorer)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文