This is the method definition:
[DllImport("user32.dll")]
public static extern int SendMessage(IntPtr hWnd, int msg, IntPtr lparam, IntPtr wparam);
This is the call to SendMessage:
//WM_COPY = 0x0301
SendMessage(handle, WM_COPY, IntPtr.Zero, IntPtr.Zero);
This is how I am retrieving the data:
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_COPYis 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.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…