GetInputState (user32)
Last changed: -68.50.135.87

.
Summary

C# Signature:

[DllImport("user32.dll")]
static extern bool GetInputState();

User-Defined Types:

None.

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

This function can greatly boost the performance of any application. When calling Application.DoEvents() to make the UI responsive, it generally decreases application performance. With this function, we make sure there is at least one event (keyboard or mouse) that needs to be processed before calling Application.DoEvents(). (VB2TheMax.com : Francesco Balena)

    public bool CheckEvents()
    {
       if ( !GetInputState() )
          return false;
       else
       {
          Application.DoEvents();
          return true;
       }
    }

Alternative Managed API:

Do you know one? Please contribute it!

Documentation