R
roshan
All,
Hello. I am a Software Developer currently creating an emulation
program for our company's System Administrator. He will be able to
call the program and emulate any keyboard combination, or at least
that's the goal. Problem is I am having severe troubles emulating
Shift key combos like (Shift key + End) for example. Nothing happens!
Some combos work such as Shift key + h which gives 'H'. The problem is
more specifically related with emulating the highlighting of characters
which is done for copying or cutting text. The OS I am using is
Windows 2000. Just to let you view a snippet of the code I'm trying to
execute, here it is:
keybd_event(VK_SHIFT, MapVirtualKey(VK_SHIFT, 0), 0, 0);
Sleep(250);
keybd_event(VK_END, MapVirtualKey(VK_END, 0), 0, 0);
Sleep(250);
keybd_event(VK_END, MapVirtualKey(VK_END, 0), KEYEVENTF_KEYUP, 0);
Sleep(250);
keybd_event(VK_SHIFT, MapVirtualKey(VK_SHIFT, 0), KEYEVENTF_KEYUP,
0);
Sleep(250);
Please note I've also tried:
VK_LSHIFT instead of VK_SHIFT, but doesn't work.
VK_RSHIFT instead of VK_SHIFT. The highlighting and text copying work,
but shift key stays pressed down afterward. I have to manually hit
right shift key to release it. I shouldn't have to do this.
Please provide any help if you know the solution.
Regards,
Roshan
Hello. I am a Software Developer currently creating an emulation
program for our company's System Administrator. He will be able to
call the program and emulate any keyboard combination, or at least
that's the goal. Problem is I am having severe troubles emulating
Shift key combos like (Shift key + End) for example. Nothing happens!
Some combos work such as Shift key + h which gives 'H'. The problem is
more specifically related with emulating the highlighting of characters
which is done for copying or cutting text. The OS I am using is
Windows 2000. Just to let you view a snippet of the code I'm trying to
execute, here it is:
keybd_event(VK_SHIFT, MapVirtualKey(VK_SHIFT, 0), 0, 0);
Sleep(250);
keybd_event(VK_END, MapVirtualKey(VK_END, 0), 0, 0);
Sleep(250);
keybd_event(VK_END, MapVirtualKey(VK_END, 0), KEYEVENTF_KEYUP, 0);
Sleep(250);
keybd_event(VK_SHIFT, MapVirtualKey(VK_SHIFT, 0), KEYEVENTF_KEYUP,
0);
Sleep(250);
Please note I've also tried:
VK_LSHIFT instead of VK_SHIFT, but doesn't work.
VK_RSHIFT instead of VK_SHIFT. The highlighting and text copying work,
but shift key stays pressed down afterward. I have to manually hit
right shift key to release it. I shouldn't have to do this.
Please provide any help if you know the solution.
Regards,
Roshan