是否有可能发送WM_COPY消息,文本复制比剪贴板以外的地方? [英] Is it possible to send a WM_COPY message that copies text somewhere other than the Clipboard?
问题描述
这是该方法的定义:
[DllImport("user32.dll")]
public static extern int SendMessage(IntPtr hWnd, int msg, IntPtr lparam, IntPtr wparam);
这是调用SendMessage函数:
This is the call to SendMessage:
//WM_COPY = 0x0301
SendMessage(handle, WM_COPY, IntPtr.Zero, IntPtr.Zero);
这是我如何检索数据:
string text = System.Windows.Forms.Clipboard.GetText();
我希望做同样的事情,只是我不希望将数据复制到剪贴板。是否有可能将数据复制到内存中的其他部分?如果是这样,怎么样?
I'd like to do the same thing except that I don't want the data to be copied to the clipboard. Is it possible to copy the data to some other part in memory? If so, how?
推荐答案
没有。你不能控制什么,当它接收到消息等应用程序就可以了。你得到什么行为目标窗口具有该消息并没有别的(除非你,比你可以自己处理控制目标)。
No. You can't control what other application will do when it receives a message. You get whatever behavior target window has for that message and nothing else (unless you control the target too, than you can handle it yourself).
WM_COPY
只是一个消息(也它是标准之一,意义特别的方式来处理) - 一些窗口将处理它,有些则不会。随着对MSDN WM_COPY 定义一>将保存文本编辑控件。
WM_COPY
is just a message (also it is standard one and make sense to be handled in particular way) - some windows will handle it, some will not. As defined on MSDN WM_COPY will save text for edit control.
应用程序发送WM_COPY消息发送给编辑控件或组合框中当前选择复制到CF_TEXT格式剪贴板。
An application sends the WM_COPY message to an edit control or combo box to copy the current selection to the clipboard in CF_TEXT format.
如果您正在实现自己的应用程序来处理,无论你想WM_COPY你可以复制数据,也如果子类编辑控制它将使有很大的意义,保持默认的行为...
If you are implementing your own application that handles WM_COPY you can copy data wherever you want, also if sub-classing edit controls it would make a lot of sense to keep default behavior...
这篇关于是否有可能发送WM_COPY消息,文本复制比剪贴板以外的地方?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!