私はC#で次のコンソールアプリケーションを持っています
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Timers;
using System.Windows.Forms;
namespace PreventScreenshot
{
class Program
{
[STAThread]
public static void Main(string[] args)
{
System.Timers.Timer timer1 = new System.Timers.Timer();
timer1.Elapsed += new ElapsedEventHandler(timer_Tick);
timer1.Interval = 1000;
timer1.Enabled = true;
timer1.Start();
Console.WriteLine("---Prevent Screenshot from being taken---");
Console.WriteLine();
Console.WriteLine("DLL operation started. Try to take a screenshot");
Console.WriteLine();
Console.WriteLine("Press enter to exit");
Console.ReadLine();
}
public static void timer_Tick(object sender, EventArgs e)
{
Clipboard.Clear();
}
}
}
おそらく、アプリケーションは毎秒クリップボードをクリアします。しかし、それは機能していません。何が問題ですか?
編集:
コードを編集しただけです。プログラムを実行しようとすると、クリップボードがまだクリアされません。何が起こっている?