Reputation:
I want to write program to learn vocabulary. Simply each time, when I copy a word to clipboard, It will save them to text file.
so, there are requirements, I think that is:
all done by C#. so, plz give me some advice! thank you very much!
Upvotes: 2
Views: 7755
Reputation: 212
The SetClipboardViewer is an older protocol dating back to Windows 95. The newer version is the AddClipboardFormatListener
Here is a writeup showing how to use the AddClipboardFormatListener in C#:
Monitor for clipboard changes using AddClipboardFormatListener
Best of luck.
Upvotes: 0
Reputation: 43110
Detect even and save words to text file everytime I copy a word to clipboard.?
To detect clipboard changes use the SetClipboardViewer.
Here are instructions of how to create a clipboard viewer in C#:
Create a Windows Clipboard Monitor in C# using SetClipboardViewer
Upvotes: 4
Reputation: 8216
There's an example in the .NET SDK called ClipboardSpy.
Here's an example even:
static void Main(string[] args)
{
while (true)
{
if (Clipboard.ContainsText())
{
string s = Clipboard.GetText();
Console.WriteLine(s);
Clipboard.Clear();
}
}
}
Upvotes: 7