WM_Copy,wm_gettext和wm_keydown失败? [英] WM_Copy, wm_gettext and wm_keydown fail?

查看:95
本文介绍了WM_Copy,wm_gettext和wm_keydown失败?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题:我需要从Windows应用程序(而不是我的程序)的窗口中获取选定的文本.我正在Delphi XE中工作,我尝试访问的软件是过去15年中使用C,C ++,VB构建的kluge,谁知道呢.我没有源代码.我尝试读取的编辑框(RTF备忘录)属于"Ter32Class"类.当我使用 wm_copy 时,剪贴板没有任何内容.当我使用 wm_gettext 时,什么都没有.当我使用 wm_keydown 命令(模拟 Ctrl - Ins Ctrl - C kbd>)什么也没发生.请注意,我可以让所有这些替代方法都可以在写字板,记事本和FireFox中使用,但不能在此应用程序中使用(顺便说一下,也可以在OpenOffice中使用,但这不是问题).我能够以编程方式从此框中获取文本的唯一方法是通过简单的"send ^c"命令使用自动快捷键.虽然有效,但它并不雅致.帮助?!?

The problem: I need to obtain the selected text from a window in a Windows application (not my program). I am doing my work in Delphi XE and the software I am attempting to access is a kluge built over the past 15 years with C, C++, VB and who knows what else. I do not have the source code. The edit box (an RTF memo) I am attempting to read is of the class "Ter32Class". When I use wm_copy, nothing goes to the clipboard. when I use wm_gettext, nothing. When I use wm_keydown commands (to simulate Ctrl-Ins or Ctrl-C) nothing happens. Note that I can get all of these alternatives to work in wordpad, notepad, and FireFox but not this application (or OpenOffice, incidentally, but that's not the issue). The only way I have been able to programmatically obtain text from this box is to use autohotkey with the simple "send ^c" command. While it works, it is inelegant. HELP?!?

更多信息:窗口层次结构:Ter32Class是OI_Mdi的子级,而OI_Mdi是MDIClient的子级,而MDIClient是OI_Window的子级.我正在深入研究以获取适当的句柄,因为它将响应粘贴命令.

More information: Window hierarchy: Ter32Class is a child of OI_Mdi which is a child of MDIClient, which is a child of OI_Window . I am drilling down to obtain the appropriate handle as it will respond to a paste command.

我正在使用Delphi XE,但是如果没有Delphi XE专家的帮助,我会喜欢C ++或VB中的任何解决方案.

I am using Delphi XE but I'd love any solution in C++ or VB if no Delphi XE gurus have the answer.

推荐答案

来自

我需要谈谈的一个窗口是Ter32Class类, 显然是TE Edit Control,它不是继承自的编辑器 标准的RichText控件

One of the windows I need to talk to is of class Ter32Class which apparently is a TE Edit Control, an editor that doesn't inherit from the standard RichText Control

与此控件进行通讯的已发布方法是通过其DLL

The published method of talking to this control is via it's DLL

因此,除非发生了什么变化(发布日期是2006年),否则您似乎需要使用它的dll来获取文本.

so unless something has changed (post is 2006), it appears you'll need to use it's dll to get the text.

来自子系统(TE Edit控件网站)

应用程序界面功能

Application Interface functions

GetTerBuffer:检索窗口文本
处理GetTerBuffer(hWnd,size)

GetTerBuffer: Retrieve Window Text
HANDLE GetTerBuffer(hWnd, size)

这篇关于WM_Copy,wm_gettext和wm_keydown失败?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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