Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

c# key sequence

Options

Comments

  • Registered Users Posts: 2,082 ✭✭✭Tobias Greeshman


    The problem with the key combination Ctrl+Pause/Break is that it's a special key combination that get triggered before the KeyDown handler gets access to it. It will terminate/pause a program in execution.

    There is a way to get around this, by means of what is called a Keyboard Hook.

    Have a look at the Win API Function SetWindowsHookEx

    Example: http://delphi.about.com/library/bluc/text/uc063001a.htm


  • Registered Users Posts: 362 ✭✭theone


    Thanks for that

    I'm using it to send a break to a serial device, I could simulate that key sequence by changin the com port settings then simulating the spacebar being held down,but doing it by just simulating the key sequence is a much more efficient way of doing it.

    I'll check it out thanks.


  • Registered Users Posts: 362 ✭✭theone


    got it to work once hasn't worked since though

    SendKeys.SendWait("^{BREAK}");

    thats under a button click event

    that simulates ctrl +pause/break,I'm guessing thats where the hook comes in,but if it worked once can't understand why it won't work again.


Advertisement