Link to home
Start Free TrialLog in
Avatar of amielDorel
amielDorel

asked on

using keybd_event() function in C$#

How to use the function    keybd_event(); in C#  which fiels need to be included;  please provide a
short example, I am getting syntax errors,  

Avatar of vilimed
vilimed

Your best bet would be to use the SendKeys class to send keyboard
strokes to your application.
Here's one I use for KeyUp

/// <summary>
            /// Raises the KeyUp event
            /// </summary>
            /// <param name="e">A KeyEventArgs that contains the event data</param>
            protected override void OnKeyUp(KeyEventArgs e)
            {
                  base.OnKeyUp(e);

                  if (e.KeyCode == Keys.Space || e.KeyCode == Keys.Enter)
                  {
                        this.Collapsed = !this.Collapsed;
                  }
            }

John
ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial