hardware buttons

G

Guest

Hi NG,

I use this code, but if I put on one Hardwarebutton I get 2 Messages. What
is wrong?

Greetings
Burghard


public partial class DialogLearn : Form
{
private HardwareButton hwb1, hwb4;

public DialogLearn()
{
KeyPreview = true;
KeyUp += new KeyEventHandler(DialogLearnOnKeyUp);
HBConfig();
}

void DialogLearnOnKeyUp(object sender, KeyEventArgs e)
{
MessageBox.Show(e.KeyCode.ToString());
}

private void HBConfig()
{
try
{
hwb1 = new HardwareButton();
hwb4 = new HardwareButton();
hwb1.AssociatedControl = this;
hwb4.AssociatedControl = this;
hwb1.HardwareKey = HardwareKeys.ApplicationKey1;
hwb4.HardwareKey = HardwareKeys.ApplicationKey4;
}
catch (Exception exc)
{
MessageBox.Show(exc.Message + " Check if the hardware button is
physically available on this device.");
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top