I looking for a solution where I can "press" two keys at the same time using Java
or .NET
. Recently I have tried below code in Java which is working perfectly fine on one key. Here is the code for one key
r.keyPress(KeyEvent.VK_R);
Upon execution of this code it press letter 'R'. Now what I'm looking is to press "Windows+R" keys or say a combination of multiple keys not more than two keys at the same time.
ok, from the doc of Robot
class, just do:
r.keyPress(KeyEvent.VK_WINDOWS);
r.keyPress(KeyEvent.VK_R); // VK_WINDOWS key still pressed
r.keyRelease(KeyEvent.VK_R);
r.keyRelease(KeyEvent.VK_WINDOWS);
the keyPress
method does not relese the key, so this should work