我用VS2008实现WM的手机震动,从网上找的源码,可是找不到nled.h文件
源码如下
#include "定时闹钟.h"
#include "定时闹钟Dlg.h"
#include <windows.h>
#include <commctrl.h>
//下面include 本身是#include <nled.h> 可是找不到文件,我用搜索找到nled.h后,更改了包含目录如下
#include "D:\Program Files\Microsoft Visual Studio 9.0\SmartDevices\SDK\PocketPC2003\Include\nled.h"
//但是提示 error C3861: “NLedSetDevice”: 找不到标识符
//我在“D:\Program Files\Microsoft Visual Studio 9.0”目录下寻找包含NLedSetDevice关键字的文件,结果
//一个没找到:(郁闷
void StartVirbate()
{
NLED_SETTINGS_INFO settings ;
memset(&settings,0,sizeof(NLED_SETTINGS_INFO));
settings.LedNum= 1;
settings.OffOnBlink= 1;
NLedSetDevice(NLED_SETTINGS_INFO_ID, &settings);
}
void StopVirbate()
{
NLED_SETTINGS_INFO settings;
memset(&settings,0,sizeof(NLED_SETTINGS_INFO));
settings.LedNum= 1;
settings.OffOnBlink= 0;
NLedSetDevice(NLED_SETTINGS_INFO_ID, &settings);
}
void C定时闹钟Dlg::OnBnClickedButtonZhendong()
{
// TODO: 在此添加控件通知处理程序代码
StartVirbate();
StopVirbate();
}
[解决办法]
Vibrate实现振动,VibrateStop停止振动,VibrateGetDeviceCaps返回设备对振动的支持情况。
HRESULT Vibrate(DWORD cvn, const VIBRATENOTE * rgvn, BOOL fRepeat, DWORD dwTimeout);
HRESULT VibrateStop (void);
int VibrateGetDeviceCaps (VIBRATEDEVICECAPS vdc);