我想停止監視器停止睡眠(這是由公司策略驅動的)。以下是我正在使用的代碼移動鼠標以停止睡眠監視器
while (true)
{
this.Cursor = new Cursor(Cursor.Current.Handle);
Cursor.Position = new Point(Cursor.Position.X - 50, Cursor.Position.Y - 50);
Cursor.Clip = new Rectangle(this.Location, this.Size);
System.Threading.Thread.Sleep(2000);
this.Cursor = new Cursor(Cursor.Current.Handle);
Cursor.Position = new Point(Cursor.Position.X + 50, Cursor.Position.Y + 50);
Cursor.Clip = new Rectangle(this.Location, this.Size);
}
我可以看到沒有While循環的鼠標移動。但是,雖然它只移動鼠標一次,然後限制鼠標移動到右側。
有沒有更好的方法來做到這一點?
http://www.perlmonks.org/?node=xy+problem – EZI
添加一個'Thread.Sleep(2000);'最後,你會看到這個舉動。但我不知道這是否會阻止顯示器進入睡眠狀態。 – Bolu
顯示器已被您的公司策略設置爲睡眠狀態的原因有很多,打破這些策略聽起來像是baaaaad的想法。 – DavidG