'HDEVNOTIFY' : missing storage-class or type specifiers

由于要响应设备的插拔,所有要注册设备的事件通知,用到'HDEVNOTIFY' 等的时侯,编译出现了莫名奇妙的错误:

error C2146: syntax error : missing ';' before identifier 'm_hDevNotify'

error C2501: 'HDEVNOTIFY' : missing storage-class or type specifiers

error C2065: 'UnregisterDeviceNotification' : undeclared identifier

error C2065: 'DEV_BROADCAST_DEVICEINTERFACE' : undeclared identifier

error C2065: 'DEVICE_NOTIFY_WINDOW_HANDLE' : undeclared identifier

 

后在MSDN上找到答案,只要在stdafx.h的开始定义WINVER大于0x0500即可:

例如: #define WINVER 0x0501

你可能感兴趣的:(VC/MFC)