SendKeys.Send:拒绝访问

时间:2016-08-09 05:12:44

标签: c# vb.net visual-studio-2010 c#-4.0

我有一个使用SendKeys.Send函数的应用程序send CTRL+C and CTRL+V Keys.我的操作系统是Windows Server 2012 R2。它首先发送密钥没有问题但是它说Access被拒绝。为什么?

我试过使用这两种方法,

SendKeys.Send() 

My.Computer.Keyboard.SendKeys()

两个函数在某一点都给出相同的错误。

为什么它不允许我发送密钥?

************** Exception Text **************
System.ComponentModel.Win32Exception (0x80004005): Access is denied
   at System.Windows.Forms.SendKeys.SendInput(Byte[] oldKeyboardState, Queue previousEvents)
   at System.Windows.Forms.SendKeys.Send(String keys, Control control, Boolean wait)
   at Microsoft.VisualBasic.Devices.Keyboard.SendKeys(String keys)
   at WhatsApp_API_Sender.Form1.timercron_Tick(Object sender, EventArgs e)
   at System.Windows.Forms.Timer.OnTick(EventArgs e)
   at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

0 个答案:

没有答案