C# SendKeys function

By | June 29, 2015

Using the function we can easily connect multiple keys or even pinting out whole strings just by using one key or just applying for example the F_Keys to Hotkeys.

So let’s see how it works:

static void _sendkeys()
{
    string _text = "the matrix has you";

    foreach (char c in _text)
    {
        // prints out each character of _text each after 500ms
        SendKeys.SendWait(c.ToString());                 
        Thread.Sleep(500);
    }
}

 

So this basic example would print out the text “the matrix has you” with a sleep time of 500ms after each character.

You can also use {BACKSPACE}, {ENTER}, etc. which will send the backspace key and the enter key like so:

static void _sendkeys()
{
    SendKeys.SendWait("{BACKSPACE}");
    SendKeys.SendWait("{ENTER}");
    SendKeys.SendWait("{TAB}");
}

To see what keys exist to use for the SendKeys function click here!

Kind Regards

3 thoughts on “C# SendKeys function

  1. vidéos sexe

    This is very interesting, You are a very skilled blogger.
    I’ve joined your feed and look forward to seeking more of your wonderful post.
    Also, I have shared your site in my social networks!

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *