This documentation is archived and is not being maintained.

HardwareButton Class

Allows overriding the functionality of Pocket PC hardware buttons.

Namespace: Microsoft.WindowsCE.Forms
Assembly: Microsoft.WindowsCE.Forms (in microsoft.windowsce.forms.dll)

public ref class HardwareButton : public Component
public class HardwareButton extends Component
public class HardwareButton extends Component
Not applicable.

You can configure a button on a Pocket PC to activate a Form, Panel, or custom control in your application by doing the following:

  • Create an instance of HardwareButton.

  • Set the AssociatedControl property to the form or control you want to activate.

  • Set the HardwareKey property to one of the HardwareKeys enumeration values. You can configure up to six hardware buttons.

When a hardware button is associated with a control, the control receives a KeyDown event when the button is pressed and a KeyUp event when the button is released.

To return a hardware button to its original state, set the AssociatedControl property to a null reference (Nothing in Visual Basic).

Note that some Pocket PCs have a different number of hardware buttons besides six. Also, not all buttons are supported by the operating system. Windows Mobile 2003 for Pocket PC supports four buttons and Windows Mobile version 5.0 software for Pocket PC supports five buttons.

This class is not supported on the Smartphone and other Windows CE devices that are not Pocket PCs.

The following code example shows how to activate a form using the first and fourth hardware buttons on a Pocket PC.

No code example is currently available or this language may not be supported.


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows Mobile for Pocket PC

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Compact Framework

Supported in: 2.0