|
-
Nov 21st, 2007, 09:45 AM
#1
Thread Starter
Junior Member
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 ?
-
Nov 21st, 2007, 12:39 PM
#2
Re: On Screen KeyBoard
I really don't understand this one.
Why would you need to sendkeys to your own program?
-
Nov 21st, 2007, 06:09 PM
#3
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
-
Nov 30th, 2007, 07:45 PM
#4
New Member
Re: On Screen KeyBoard
Also remember that due to Vista's security its best to use API instead of SendKeys... 
-dustin
-
Nov 30th, 2007, 09:49 PM
#5
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|