Controlling Notification LED in Windows Mobile

To control the Notification LEDs in Windows Mobile, we can use the API NLedSetDevice. The syntax of is defined as:

BOOL WINAPI NLedSetDevice(UINT nDeviceId,void* pInput);

The nDeviceId parameter specifies the type of information to set. The only supported value is NLED_SETTINGS_INFO_ID, which set the sets the settings for the Notification LED. The second parameter is a pointer to NLED_SETTINGS_INFO structure, which is defined as:

UINT LedNum;
INT OffOnBlink;
LONG TotalCycleTime;
LONG OnTime;
LONG OffTime;
INT MetaCycleOn;
INT MetaCycleOff;

There could be more than one LED present in the device. You can specify which LED to control in the LedNum member. The following code snippet controls the LED on or off:

void SetLED(int nLed,BOOL bOn)


sInfo.LedNum = nLed;
sInfo.OffOnBlink = bOn ? 1 : 0;


The following code retrieves the number of LEDs present in the device:

NLED_COUNT_INFO sCount = {0};


Leave a Reply

Your email address will not be published. Required fields are marked *