Keyboard.LeaveAllKeys() does not work.

Feb 13, 2011 at 9:34 AM

I am trying to automate something. In that I am using Keyboard.PressSpecialKey and holdkey functions.

After I am done I am using leaveAllKeys function but the key is still pressed. Can someone help me understand what is the problem.

And how can I solve it. The code is:

objKeyboard.PressSpecialKey(Core.WindowsAPI.KeyboardInput.SpecialKeys.CONTROL);

objKeyboard.HoldKey(Core.WindowsAPI.KeyboardInput.SpecialKeys.CONTROL);

objKeyboard.Enter("S");objKeyboard.LeaveKey(Core.WindowsAPI.KeyboardInput.SpecialKeys.CONTROL);

Thread.Sleep(5000);objKeyboard.PressSpecialKey(Core.WindowsAPI.KeyboardInput.SpecialKeys.ALT);

objKeyboard.HoldKey(Core.WindowsAPI.KeyboardInput.SpecialKeys.ALT);objKeyboard.Enter("W");

Thread.Sleep(1000);

objKeyboard.Enter("C");

objKeyboard.LeaveKey(Core.WindowsAPI.KeyboardInput.SpecialKeys.ALT);

objKeyboard.LeaveAllKeys();