Archived

This topic is now archived and is closed to further replies.

malpass

using keybd_event() correctly

Recommended Posts

When I use keybd_event() like this:
string str = "CaSeSeNsItIvE @£$"
for (int i=0; i);

    keybd_event(c,0,0,0);
    keybd_event(c,0,KeyUp,0);
}
 
where KeyUp is defined as the WM_KEYUP, the output is all lowercase, even the @£$ come out as ''3 and 4 (the numbers under them, on my keyboard anyway) How do I use keybd_event() so whatever I send the output is the same?

Share this post


Link to post
Share on other sites
(I''m not positive, but if I had to guess...)

When You press a key on the keyboard, say ''a'', it just sends ''a'' to the computer. Now if you''re holding down shift at the same time (i.e. trying to type ''A'') then the computer get''s ''a'' and ''shift'' and has to interpret that into ''A''. So maybe the int representations of ''a'' and ''A'' are interpreted just as ''a'' when it''s a keyboard event.

The deal with the @$ and 34 stuff is probably something along the same lines.

Share this post


Link to post
Share on other sites