Thread: Help with keybd_event()

  1. #1
    Registered User
    Join Date
    Aug 2003
    Posts
    288

    Help with keybd_event()

    Hey again,

    Im trying to use the keybd_event function to send the "@" letter to a program, so far ive tried almost every combination and none work:

    Code:
    keybd_event('@', 0, 0, 0);
    keybd_event('@', 0, KEYEVENTF_KEYUP, 0);
    Code:
    keybd_event('2', 1, 0, 0);
    keybd_event('2', 1, KEYEVENTF_KEYUP, 0);
    Code:
    keybd_event('2', 0, KEYEVENTF_EXTENDEDKEY | 0, 0);
    keybd_event('2', 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
    for the last 2 attempts i actually thought that maybe it would trigger a shift command or something.

  2. #2
    Registered User
    Join Date
    Aug 2003
    Posts
    288
    hmm i think i might have figured it out, but im not sure if its the most efficient or right way to do it:

    Code:
    keybd_event(VK_SHIFT, 0, 0, 0);
    keybd_event('2', 0, 0, 0);
    keybd_event('2', 0, KEYEVENTF_KEYUP, 0);
    keybd_event(VK_SHIFT, 0, KEYEVENTF_KEYUP, 0);
    and if its right and efficient, im sorry about making a new thread for no reason, its just that ive tried all combinations over and over for 1 hour until i just stopped thinking and this one came to mind.

  3. #3
    Registered User
    Join Date
    Aug 2003
    Posts
    288
    I was also wondering, why doesnt the symbols, ";", ":", etc. work

    ive tried:

    Code:
    keybd_event(';', 0, 0, 0);
    keybd_event(';', 0, KEYEVENTF_KEYUP, 0);
    Ive searched through the VK Keys and havent found anything to do with colons

    Any help would be appreciated, sorry for posting alot but theres problem after problem

    thanx again

Popular pages Recent additions subscribe to a feed