how to vibrate
#include <windows.h>
#include <nled.h>
// from the platform builder <Pwinuser.h>
extern "C" {
BOOL WINAPI NLedGetDeviceInfo( UINT nInfoId, void *pOutput );
BOOL WINAPI NLedSetDevice( UINT nDeviceId, void *pInput );
};
void LedOn(int id)
{
NLED_SETTINGS_INFO settings;
settings.LedNum= id;
settings.OffOnBlink= 1;
NLedSetDevice(NLED_SETTINGS_INFO_ID, &settings);
}
void LedOff(int id)
{
NLED_SETTINGS_INFO settings;
settings.LedNum= id;
settings.OffOnBlink= 0;
NLedSetDevice(NLED_SETTINGS_INFO_ID, &settings);
}
int WINAPI WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
for (int i=0 ; i<10 ; i++)
{
LedOn(1);
Sleep(400);
LedOff(1);
Sleep(200);
}
return 0;
}
using STL with msevc
(STL = standard template library)
msevc v3.0 does not come standard with a STL implementation,
a good STL port to windows CE is stl_evc
msevc v4.0 does have STL, problem is though that if you don't add
"#pragma warning(disable: 4786)" you will get thousands of useless warnings.
and also, the v4.0 stl uses exceptions, which will cause the compiler to complain that
exceptions are not actually supported.
what is lacking in msevc is RTTI ( runtime type information ), because of this you cannot
throw and catch exceptions in a standard C++ way. You can however use something that microsoft
calls 'structured exception handling', with __try, __except, RaiseException, __finally.
how to trap the hardware phone buttons
use GetAsyncKeyState(key), to poll the state of specific keys
these are the key codes for the xda:
// these constants are xda-specific:
#define VK_HANGUP 0x73 // VK_F4
#define VK_ANSWER 0x72 // VK_F5
#define VK_TOUCHPAD 0x01 // VK_LBUTTON
#define VK_VOLUME 0x75 // VK_F6
#define VK_TOPBUTTONS 0x5b // VK_LWIN
// VK_TOPBUTTONS is sent together with one of these:
#define VK_CALENDER 0xc1
#define VK_CONTACTS 0xc2
// note that when holding the navigator button down continuously,
// occasionally the OS will report no keys pressed down.
#define VK_NAVIGATOR_MOVE 0x84 // VK_F21
// VK_NAVIGATOR_MOVE is sent together with one of these:
#define VK_NAVIGATE_LEFT 0x25 // VK_LEFT
#define VK_NAVIGATE_UP 0x26 // VK_UP
#define VK_NAVIGATE_RIGHT 0x27 // VK_RIGHT
#define VK_NAVIGATE_DOWN 0x28 // VK_DOWN
#define VK_NAVIGATOR_SELECT 0x86 // VK_F23
#define VK_ONOFF 0xdf // VK_OFF