Is there another way to do this
Thanks in advance, Ran.
EDIT; Thanks to the moderator, Wasn't sure if this fits in Windows.Forms, As i haven't mentioned any specific Visual elements.
Hi ChaosBlade
You can try to use Clipboard class. The Clipboard class provides methods that you can use to interact with the Windows operating system Clipboard feature. You code may be something like that.
IDataObject iData = Clipboard.GetDataObject();
if (iData.GetDataPresent(DataFormats.Text)) { this.richTextBox1.Text = (string)iData.GetData(DataFormats.Text); }
Hope it helps.
Regards
Rong-Chun, Thanks for your reply, But you perhaps misunderstood me.
I am using the Clipboard.SetText method in my application, But the pasting needs to occur at whatever active window\application at the time of pressing the hooked keyboard hotkey. I.e. I could be in a chat program, in a certain textbox and click the hotkey. My application would catch the keypress, do its logic, and set some text into the clipboard. The next stage which i can't seem to acheive, would be simulating a ctrl+v keypress at wherever the user was - Resulting in the info i posted in the clipboard pasted.
I've seen the SendInput API method, But i'm not sure how to use it correctly under .NET\Pinvoke - It uses some structs which im unsure as how to represent in .NET.