Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SendKeys (multiple simultaneously)

Status
Not open for further replies.

sweetac

IS-IT--Management
Nov 2, 2006
77
US
Helly, I am trying to have my code send multiple keys together (ctl+alt+shift+q). I have tried System.Windows.Forms.SendKeys.Send("^(%(+(q)))") where ^=ctl, %=alt, and +=shift but it is not working. Would I need to somehow select desktop or winlogon windows before calling it? Is there another way? The key combination shows a hidden window that a 3rd party app is managing.

Thanks!
 
Did you try sending it like this:

SendKeys.Send("^%+q")

Unless I'm mistaken, the Send method will read the input and automatically pick out the keywords. So what was getting sent through was ctrl+(, then alt+(, then shift+(, then "q)))".

im in ur stakz, overflowin ur heapz!
 
Yeah, tried that too. I think somehow the focus needs to be pulled from the current window. I have seen some cpp examples of the ctl+alt+del call where desktop (winlogon) is set first, and then postmessage is called to invoke it but they first convert the keys to long and then perform a logical or on the alt and the control and calculate a new long to pass in. I'm not sure why it is done that way.
 
I don't know if this is the most correct way as it is a hold over from VBA, but you can use AppActivate.

-I hate Microsoft!
-Forever and always forward.
-My kingdom for a edit button!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top