In Java, you can use Java. AWT. Robot to simulate messages such as keyboard messages and mouse messages.
First try
Robot robot = new Robot();robot.keyPress(KeyEvent.VK_CONTROL);robot.keyPress(KeyEvent.VK_ALT);robot.keyPress(KeyEvent.VK_RIGHT);robot.keyRelease(KeyEvent.VK_RIGHT);robot.keyRelease(KeyEvent.VK_ALT);robot.keyRelease(KeyEvent.VK_CONTROL);
Successfully executed the next piece of qqmusic: CTRL + ALT + Right
Next to kuwo: Ctrl + Shift + Right
Robot robot = new Robot();robot.keyPress(KeyEvent.VK_CONTROL);robot.keyPress(KeyEvent.VK_SHIFT);robot.keyPress(KeyEvent.VK_RIGHT);robot.keyRelease(KeyEvent.VK_RIGHT);robot.keyRelease(KeyEvent.VK_SHIFT);robot.keyRelease(KeyEvent.VK_CONTROL);
Crazy... No response. Do you not support the shift key? Google
Http://www.webdeveloper.com/forum/showthread.php? T = 221722
This elder brother encountered the same problem, but before December 31, year 45, he did not provide a solution, but gave a code to record the Keyboard Message. Through this code, he found that after pressing shift, pressing right will trigger the release event of shift and press event of right. Is it a Java bug and Google?
Https://forums.oracle.com/forums/thread.jspa? Threadid = 2230592
Another man-in-Law also encountered this problem. It seems that I am not alone, but also what happened in the past few months. Someone pointed out the problem at him, which is really a Java bug.
Bug 4908075
Bug 6463168
It is puzzling that the bug has been submitted for N years and has not been fixed yet.
Fortunately, there is a way to bypass this bug: Turn off the numlock keys
Toolkit.getDefaultToolkit().setLockingKeyState(KeyEvent.VK_NUM_LOCK, false);
This solves the problem that shift cannot be pressed together with other keys when sending a key combination message.
Http://weblogs.java.net/blog/joshy/archive/2003/08/swinghack_keybo.html
Later, it was found that the method was originally provided by a renxiong and ignored, but the website was not posted.
The pen is stopped...