Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If I understand it correctly then what you have doesn't sound too bad. Are you saying that:</p> <ul> <li>You have a client server architecture.</li> <li>At the server (presumably at command console or management application) you press a key.</li> <li>The key corresponds to an action. The action needs to be invoked at the client.</li> </ul> <p>You could implement this using asynchronous WCF. See <a href="https://stackoverflow.com/questions/353383/beginners-wcf-question-consumable-asynchronous-services">here</a> and <a href="https://stackoverflow.com/questions/400798/how-to-make-a-call-to-my-wcf-service-asynchronous">here</a> for more some more info. One way to look at this problem is as a distributed observer pattern. Your server is the subject and the client(s) are the observer(s).</p> <hr> <p>Update: Handling Key Events in .Net</p> <p>You could try adding a KeyDown event handler to your form:</p> <pre><code>private void Form1_KeyDown(object sender, KeyEventArgs e) { if (e.Control &amp; e.KeyCode == Keys.C) { MessageBox.Show( "Ctrl + C pressed" ); // Swallow key event, i.e. indicate that it was handled. e.Handled = true; } } </code></pre> <p>But if you have any controls on your form then you won't get the event. What you probably need to do is sniff windows messages using a message filter. E.g.</p> <pre><code>public class KeyDownMessageFilter : IMessageFilter { public const int WM_KEYDOWN = 0x0100; public bool PreFilterMessage(ref Message m) { if (m.Msg == WM_KEYDOWN) { // Key Down return true; // Event handled } return false; } } </code></pre> <p>Add this message filter to the application using the <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.application.addmessagefilter.aspx" rel="nofollow noreferrer">AddMessageFilter</a> method. If you want to check if the CTRL key is pressed for the key down message then check the <a href="http://msdn.microsoft.com/en-us/library/ms646280(VS.85).aspx" rel="nofollow noreferrer">lparam</a>.</p> <p>If any of this isn't clear then let me know.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload