Results 1 to 5 of 5

Thread: On Screen KeyBoard

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2007
    Posts
    17

    On Screen KeyBoard

    Starting , I Think i will use SendKey . But it send the keys to My program .
    I guess i get the handle behind my program , and send the keys to it .
    Can you help me write The most easy code ?

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: On Screen KeyBoard

    I really don't understand this one.

    Why would you need to sendkeys to your own program?

  3. #3
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    708

    Re: On Screen KeyBoard

    If you want it to be easy, and use sendkeys, it will be much less reliable.

    Advanced:
    You need to prevent focus from going to your program, when you press the button.
    Take a look at this thread:http://vbforums.com/showthread.php?t=459890

    Easy:
    You could allow it to recieve focus, and then use the Ctrl-Alt-Escape key combination, to return focus to the previous program.
    http://www.codeguru.com/forum/showpo...12&postcount=1

  4. #4
    New Member
    Join Date
    Sep 2004
    Posts
    13

    Re: On Screen KeyBoard

    Also remember that due to Vista's security its best to use API instead of SendKeys...

    -dustin

  5. #5
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    708

    Re: On Screen KeyBoard

    Also remember that due to Vista's security its best to use API instead of SendKeys...
    Well you're right, but are you thinking what I'm thinking.

    By using the API, you get the return value of the key, and see if it failed, then you can abort, or try again etc. Essentially handle the failure.

    With sendkeys you usually can't do anything about failure, because it just continues to send the stream of keys to whatever application happens to have focus. There's no handling it.

    Although I read that SendKeys was upgraded to work on Vista, so perhaps they key stream aborts, when the UAC dialog pops up.
    Or does keyboard focus then go to the UAC dialog.... hmmmm I dont know that one.
    I'll test it later to make sure this is the main reason why you should use API.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width