Starting , I Think i will use SendKey . But it send the keys to My program . :lol:
I guess i get the handle behind my program , and send the keys to it .
Can you help me write The most easy code ? :thumb:
Printable View
Starting , I Think i will use SendKey . But it send the keys to My program . :lol:
I guess i get the handle behind my program , and send the keys to it .
Can you help me write The most easy code ? :thumb:
I really don't understand this one.
Why would you need to sendkeys to your own program? :confused:
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
Also remember that due to Vista's security its best to use API instead of SendKeys... :)
-dustin
Well you're right, but are you thinking what I'm thinking.Quote:
Also remember that due to Vista's security its best to use API instead of SendKeys...
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.