本站网址: YippeeSoft开心软件

本文链接: 1003 USBPHONE 资料 WINVER

1003 USBPHONE 资料 WINVER

NOTE: WINVER has been defined as 0×0500 or greater which enables
Windows NT 5.0 and Windows 98 features. When these headers were released,
Windows NT 5.0 beta 1 and Windows 98 beta 2.1 were the current versions.
For this release when WINVER is defined as 0×0500 or greater, you can only
build beta or test applications.  To build a retail application,
set WINVER to 0×0400 or visit http://www .microsoft .com/msdn/sdk
to see if retail Windows NT 5.0 or Windows 98 headers are available.
See the SDK release notes for more information.

问题是这样的  
  我在  
  class   CMainFrame   :   public   CFrameWnd  
  &leftsign;  
  ……  
  //中定义了一个函数  
  public:  
  bool   DoRegisterDeviceInterface(GUID       InterfaceClassGuid,HDEVNOTIFY   *hDevNotify);  
   
  //这个函数在msdn有,实际是RegisterDeviceNotification的一个例子  
  //其中的两个参数,我又分别定义成了,类的私有成员  
   
  private:  
  GUID   InterfaceClassGuid;  
                    HDEVNOTIFY   *hDevNotify;  
  //在理它们的定义已经包含在windows.h中,包括RegisterDeviceNotification  
  //但是编译的时候,却说  
   
  error   C2061:   syntax   error   :   identifier   \’HDEVNOTIFY\’  
  error   C2065:   \’hDevNotify\’   :   undeclared   identifier  
  error   C2065:   \’RegisterDeviceNotification\’   :   undeclared   identifier  
  等一系列错误  
   
  应该如何解决呢?这是什么原因造成的??谢谢了  

#include   "Winuser.h"
不是在#include   "Windows.h"中已经包含了Winuser.h"了吗?
这与你的操作系统有关,你可以看看Winuser.h的2643行如下  
  #if(WINVER   >=   0×0500)  
  typedef     PVOID                       HDEVNOTIFY;  
  typedef     HDEVNOTIFY           *PHDEVNOTIFY;  
   
  #define   DEVICE_NOTIFY_WINDOW_HANDLE           0×00000000  
   
  WINUSERAPI  
  HDEVNOTIFY  
  WINAPI  
  RegisterDeviceNotificationA(  
          IN   HANDLE   hRecipient,  
          IN   LPVOID   NotificationFilter,  
          IN   DWORD   Flags  
          );  
  WINUSERAPI  
  HDEVNOTIFY  
  WINAPI  
  RegisterDeviceNotificationW(  
          IN   HANDLE   hRecipient,  
          IN   LPVOID   NotificationFilter,  
          IN   DWORD   Flags  
          );  
  #ifdef   UNICODE  
  #define   RegisterDeviceNotification     RegisterDeviceNotificationW  
  #else  
  #define   RegisterDeviceNotification     RegisterDeviceNotificationA  
  #endif   //   !UNICODE  
   
  WINUSERAPI  
  BOOL  
  WINAPI  
  UnregisterDeviceNotification(  
          IN   HDEVNOTIFY   Handle  
          );  
  #endif   /*   WINVER   >=   0×0500   */  
typedef     PVOID                       HDEVNOTIFY;  
  typedef     HDEVNOTIFY           *PHDEVNOTIFY;  
  //在這個之前加入上面的..估計是個  

#if(WINVER   >=   0×0500)   就是這個其作用

请注意#if(WINVER   >=   0×0500)此处,而在windows.h有如下定义  
  #ifndef   WINVER  
  #define   WINVER   0×0400  
  #else  
  #if   defined(_WIN32_WINNT)   &&   (WINVER   <   0×0400)   &&   (_WIN32_WINNT   >   0×0400)  
  #error   WINVER   setting   conflicts   with   _WIN32_WINNT   setting  
  #endif  
  即你未定义WINVER,则系统定义为0×0400  
  解:  
  在StdAfx.h添加  
  #define   WINVER   0×0500  
   
   
  如  
  #if   _MSC_VER   >   1000  
  #pragma   once  
  #endif   //   _MSC_VER   >   1000  
   
  #define   VC_EXTRALEAN //   Exclude   rarely-used   stuff   from   Windows   headers  
  #define   WINVER   0×0500  
  即可  

原创文章,转载请注明: 转载自YippeeSoft开心软件

本文链接地址: 1003 USBPHONE 资料 WINVER

历史博文

标签:, , , , ,