使用 pinvv 检测窗口文本变化
有什么方法可以查看仅由句柄引用的“窗口”的内容是否已更改?比如从 pinvoke FindWindow 获得的一个?
Is there any way to see if the contents of a 'window' have changed, that is referenced only by a handle? Such as one obtained from a pinvoke FindWindow?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您想收到文本更改的通知,那就不行。某些窗口会向其父窗口发送更改通知,但您必须在该过程中拦截这些消息,而且并非所有窗口都会发送通知。 (我认为您使用的FindWindow不是在进程中)
如果您想获取文本并检查自己,您可以通过pinvoke到
GetWindowText
或< code>SendMessage(hwnd, WM_GETTEXT, ...); (GetWindowText 只是 SendMessage 的一个有用的包装)If you want to be notified that the text changed, then no. Some windows send notifications of changes to their parent windows, but you would have to be in the process to intercept those messages, and not all windows even send notifications. (I presume by the fact that you are using FindWindow that you are not in-process)
If you want to get the text and check for yoursef, you can do that with a pinvoke to
GetWindowText
or toSendMessage(hwnd, WM_GETTEXT, ...);
(GetWindowText is just a helpful wrapper around a SendMessage)