470,849 Members | 1,116 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,849 developers. It's quick & easy.

VC++ keybd_event and VK_SHIFT problem

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

May 30 '06 #1
1 7316
ro****@exeltech.com wrote:
[...] Some combos work such as Shift key + h which gives 'H'. The problem
is [..] VK_RSHIFT instead of VK_SHIFT. [..]

Please provide any help if you know the solution.


Please post to 'comp.os.ms-windows.programmer.win32' where this is
on topic. Here it isn't.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
May 30 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by chris | last post: by
1 post views Thread by chella | last post: by
3 posts views Thread by bradfordh | last post: by
11 posts views Thread by Tatu Portin | last post: by
11 posts views Thread by Zatts | last post: by
7 posts views Thread by Norman Diamond | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.