简体   繁体   English

用C#编写剪贴板查看器

[英]Writing a clipboard viewer in C#

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: 因此,有一些要求,我认为是:

  1. My program run in background like keylogger? 我的程序像键盘记录程序一样在后台运行?
  2. Detect even and save words to text file everytime I copy a word to clipboard.? 每次将单词复制到剪贴板时,甚至检测甚至将单词保存到文本文件中。

all done by C#. 全部由C#完成。 so, plz give me some advice! 因此,请给我一些建议! thank you very much! 非常感谢你!

There's an example in the .NET SDK called ClipboardSpy. .NET SDK中有一个名为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();
        }
    }
}

Detect even and save words to text file everytime I copy a word to clipboard.? 每次将单词复制到剪贴板时,甚至检测甚至将单词保存到文本文件中。

To detect clipboard changes use the SetClipboardViewer . 要检测剪贴板更改,请使用SetClipboardViewer

Here are instructions of how to create a clipboard viewer in C#: Create a Windows Clipboard Monitor in C# using SetClipboardViewer 以下是有关如何在C#中创建剪贴板查看器的说明: 使用SetClipboardViewer在C#中创建Windows剪贴板监视器

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM