Click here to Skip to main content
15,036,363 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How can I set focus on Notepad application and send ctrl+c to it?
EDIT : I'm actually working on an add-on for a Rss feed agregator application , I created a Form with small size, set the formBorderStyle to none and TopMost to true, and added a button so that looks like an Add-on. All I need is : when the user select the text of a Url from the navigation bar of the other application(Rss Aregator) and click on the button of my little form, the string text of the highlited link must be copyed to the clipboard. It seems that it's not an easy solution for my problem, inviting the user to copy the selected text must be more convenient... Is there another way to do that or any computer language or technology that haves strong ability to realilze easily what I'm trying to do?
Posted
Updated 28-May-13 18:11pm
v7

1 solution

1) Set focus on the notepad instance

http://stackoverflow.com/questions/1922707/setting-external-application-focus[^]

2) Use SendKeys to send "Ctrl + C" to the application to copy the selected text to the clipboard

http://msdn.microsoft.com/en-us/library/system.windows.forms.sendkeys.aspx[^]

3) Retrieve the text from the clipboard using Clipboard.GetText

http://msdn.microsoft.com/en-us/library/kz40084e.aspx[^]
   
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900