Share via


How to: Program a Press-and-Hold Feature

You can use the press-and-hold feature of a program key to create a new document. This process is similar to clicking New on the File menu on a desktop computer.

To program a press-and-hold feature for a program key

  1. Call the SHGetAppKeyAssoc function to determine the VK code of your application.

  2. Set a timer in your application to the amount of time you want a user to hold down the control. Generally, this should be no longer than one second.

  3. When the timer expires, call the Windows CE GetAsyncKeyState function using the VK code received from SHGetAppKeyAssoc.

    If GetAsyncKeyState returns a VK_DOWN message, the program control was held the entire time.

For more information about VK mapping, consult the documentation for the device driver available from the manufacturer of your target device.

See Also

How to: Modify Program Key Behavior

Mobile Device Hardware Overview

Navigation Keys

Program Keys

Send feedback on this topic to the authors.

© 2005 Microsoft Corporation. All rights reserved.