Discussions
Categories
Groups
Advertisement
Child Item
Home
Topics
Technology & Internet
Software & Web Development
Development
c# key sequence
theone
hi,
just wondering if anybody has any experience in this I'm tryin to simulate a key sequence ctrl + pause/break
I have some sort of idea through reading this
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwindowsformscontrolclasskeydowntopic.asp
but i did some searching and it dosen't seem as readily availible as I hoped.
I have no problem simulating ctrl + c for example but the ctrl + pause/break I can't do.
Find more posts tagged with
Quick Links
All Categories
Recent Posts
Activity
Unanswered
Groups
Best Of
Advertisement
Advertisement
Comments
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
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.
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.