Send Key Question

Hey Guys,

Is it possible to use send Key to do the following things, if so, How?

Press the windows key

Press a combination with the windows key

Left click/right click

Left click/right click specific coords


Hi Vincent,

It’s possible to use send keys for the first two operations you describe. Take a look at the thread on this forum for some examples.
For the third…hmm depending on your operating system, it may also be possible to use your NumberLock keys, but this can be pretty specific. In other circumstances you would probably need to enable the Ease of Access to specifically use the keyboard.
For fourth, not certain on specific coords, and bear in mind these will always be relative to the screen resolution. As such you’ll never be able to ensure you’re actually clicking on the right location. You could use SendKeys in combination with some API functions to try and activate the specific window, and then activate the specific control before using SendKeys to simulate the click.

You can get additional information about SendKeys, take a look at the MSDN article, which describes the keyboard combinations.

Really though, SendKeys should be the last option you choose, you lose control of what’s happening and have just got to hope it’s going to work.

What’s the intended purpose?