Friday, May 06, 2005

Vibrating a Pocket PC

Vibrating a Pocket PC is a simple matter of turning a led on or off. As a matter of fact, the vibrating device when present is operated through the led API. The only problem you will have to sort out is the corresponding led number as this is device-dependent. On the HTC Pocket PC Phone Edition devices, this is led number 1.

To use this functionality in your applications, use the following code:

extern "C"
{
BOOL NLedGetDeviceInfo(INT nID, PVOID pOutput);
BOOL NLedSetDevice(INT nID, PVOID pOutput);
};

void SetLedStatus(int wLed, int wStatus)
{
NLED_SETTINGS_INFO nsi;

nsi.LedNum = (INT) wLed;
nsi.OffOnBlink = (INT) wStatus;

NLedSetDevice(NLED_SETTINGS_INFO_ID, &nsi);
}

Simple, right?

No comments: