WM_Copy,wm_gettext和wm_keydown失败? [英] WM_Copy, wm_gettext and wm_keydown fail?
问题描述
问题:我需要从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.