473,625 Members | 3,251 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SendKeys to hold down keys

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(" +")
Jun 9 '06 #1
5 14862
try "+(%+)"

Cant remember the exact syntax, but I recall you preceed a combination key
press with a +
--
Regards

John Timney (MVP)
"Daniel N." <de*********@ex cite.com> wrote in message
news:Nr******** *****@fe12.lga. ..
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(" +")

Jun 9 '06 #2
'+(%+)' is not a valid SendKeys String is the error it gives me, but I will
try diffrent things, thanks
"John Timney (MVP)" <x_****@timney. eclipse.co.uk> wrote in message
news:s_******** ************@ec lipse.net.uk...
try "+(%+)"

Cant remember the exact syntax, but I recall you preceed a combination key
press with a +
--
Regards

John Timney (MVP)
"Daniel N." <de*********@ex cite.com> wrote in message
news:Nr******** *****@fe12.lga. ..
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(" +")


Jun 9 '06 #3
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?
Jun 10 '06 #4
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=k...id=8291&sid=16
http://www.codeproject.com/csharp/globalhook.asp
--
Regards

John Timney (MVP)
"Daniel N." <de*********@ex cite.com> wrote in message
news:j7******** *******@fe12.lg a...
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?

Jun 10 '06 #5
"Daniel N." wrote:
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

--
Timm Martin
Mini-Tools
..NET Components and Windows Software
http://www.mini-tools.com

Jun 13 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2865
by: Dave | last post by:
KeyDown and KeyPress events catch Page Up/Down keystrokes too late so I can't stop program from acting on them in the way it does (up selects a cell in the uppermost row and down selects a cell in the last row) How do I set up my code to respond to these key events in whatever way I prefer and stop the usual automated events I referred to above ? I want to act upon these keystrokes first. Thanks.
0
1507
by: kurotsuke | last post by:
Hi, I'm using SendKeys to send text to other applications. My problem is that the text sent is affected from the status of SHIFT keys and CAPS LOCKS keys. For example, if the caps lock key or the shift keys are down I get all the text uppercase. If the ALT key is down I don't get any text at all. How can I make the text sent independent on the keyboard status? Thanks.
1
1853
by: melanieab | last post by:
Hi again, With much help, I've finally gotten the Tab key to be recognized when a textbox is in focus, but now I'm having trouble with the up/down keys when they're focused on a custom button (on KeyDown, when I ask to show keyCode, nothing happens (except for Enter) so the focus goes to some textboxes that should never receive focus). I can think of 3 options, but don't know how to do any of them: 1) Say that these textboxes should...
2
4173
by: Daniel N | last post by:
Is there a way to hold down keys in vb.net? In the program I am writing I can simulate a MOUSE button hold down: Public Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
1
1679
by: Daniel N | last post by:
Is there a way to hold down keys in vb.net? In the program I am writing I can simulate a MOUSE button hold down: Public Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
3
2830
by: Daniel N | last post by:
In my never ending search I found code that might help me to simulate holding down keys: http://www.developerfusion.co.uk/show/68/2/ However, when I copy and paste, I get the errors;
4
3342
by: DarkOwnagePeace | last post by:
For example could I make it so when I hold down a certain key it does something, like for example how would I make it so when I hold down the "a" key it will execute a piece of code, or when I press it?
0
1297
by: ImpactMan | last post by:
Hello! I'm trying to develop one application for pocket pc with Visual Studio 2008. Now, I'm having troubles, cause I want to make a button of my application correspond to one hardware key! For example, I want software button1 makes the same that dpad UP key! Not getting any results! I've already try to search it on google and forums but, not helping!
0
4999
by: kronus | last post by:
Hi everyone, Yes, I need to use you guys as a sounding board once more :-) I have a button that has two listeners one for mouse up and the other for mouse down and they point to the same function. $btnRewind.addEventListener(MouseEvent.MOUSE_DOWN,onBtnBack); $btnRewind.addEventListener(MouseEvent.MOUSE_UP,onBtnBack);
0
8256
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8694
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8635
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8356
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8497
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6118
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5570
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4089
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4193
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.