Capture ONLY ENTER key

Jan 23, 2013 at 5:23 AM

Hi,

I only want to capture the ENTER key, is it possible?

Say for instance, if user press "123" followed by the ENTER, the count would trigger 1, not 4.

And the next instance if user press 456, followed by the ENTER, the count would trigger 2.

Is it possible?

I try to put under one of those Key event, like HookManager_KeyUp, it counts also non-ENTER keys, which I do not want. So where should I put my code under?

  public partial class TestFormHookListeners : Form
    {
        private readonly KeyboardHookListener m_KeyboardHookManager;
        private readonly MouseHookListener m_MouseHookManager;
        int count=1;

  private void HookManager_KeyUp(object sender, KeyEventArgs e)
        {
            Log(string.Format("KeyUp  \t\t {0}\n", e.KeyCode));
            if (e.KeyCode == Keys.Enter)
            {
                Count_textBox.Text = count.ToString();
            }
            count = count + 1;
        }

}