SendKeys to hold down keys

  • Thread starter Thread starter Daniel N.
  • Start date Start date
D

Daniel N.

I am trying have an application hold down the Shift key (+) and the Alt key
(%) simultaneously for a given period of time, or until a condition is met.

I tried this but it doesn't work: SendKeys.Send("%(+)")

neither does this:

SendKeys.Send("%")

SendKeys.Send("+")
 
try "+(%+)"

Cant remember the exact syntax, but I recall you preceed a combination key
press with a +
 
'+(%+)' is not a valid SendKeys String is the error it gives me, but I will
try diffrent things, thanks
 
I was up late, and finally found that:
SendKeys.Send("(+%) + (+)") did the trick, however, what I needed to do was
to do was to HOLD DOWN the alt and shift while something else was happening,
such as:

1) Hold down ALT + SHIFT
2)Move Mouse
3)Release ALT + SHIFT

Do you know how I might be able to do it?
 
Glad you got something working anyway. I knew I was on the right track.

Perhaps think about running two threads - one that sends the keys and waits
for the mouse move to end, triggering the thread to complete. Your probably
heading into the realm of windows hooks if you are looking to control
keyboard and mouse vents, notifications etc. Theres some good reading about
that would help you:

http://support.microsoft.com/?scid=kb;en-us;318804&spid=8291&sid=16
http://www.codeproject.com/csharp/globalhook.asp
 
Daniel N. said:
I was up late, and finally found that:
SendKeys.Send("(+%) + (+)") did the trick, however, what I needed to do was
to do was to HOLD DOWN the alt and shift while something else was happening,
such as:

1) Hold down ALT + SHIFT
2)Move Mouse
3)Release ALT + SHIFT

Do you know how I might be able to do it?

Hi Daniel,

In our experience, SendKeys is not the best function for sending keyboard
input, especially when it involves holding down a modifier key. The User32
function SendInput and the deprecated keybd_event work much better.

We offer a .NET component FREE for non-commercial use that will do the trick
for you:

http://www.mini-tools.com/goto/input
 
Back
Top