#define MAKE_HRESULT(sev,fac,code)\
((HRESULT) (((unsigned long)(sev)<<31) | ((unsigned long)(fac)<<16) \
| ((unsigned long)(code))) )Parameters Sev Severity code     Value Definition 
00                Success 
01                Informational 
10                Warning 
11                Error 宏定义的第一个参数sev是2位的,可定义中却是左移31位,是不是这里应该左移30啊?

解决方案 »

  1.   

    谁说sev是两位的??
    MSDN 曰:
    sev 
    The severity code. This is a 1-bit value, with 0 corresponding to success and 1 corresponding to failure. 
      

  2.   

    它的MSDN文档上明明是象下面写的 是两位的啊Parameters Sev Severity code     Value Definition 
    00                Success 
    01                Informational 
    10                Warning 
    11                Error 
      

  3.   

    我这里msdn上写的同littlepboy(vc小p孩)
      

  4.   

    MSDN中有如下关于MAKE_HRESULT宏定义的章节+ ! Platform SDK: COM MAKE_HRESULT#define MAKE_HRESULT(sev,fac,code)\
    ((HRESULT) (((unsigned long)(sev)<<31) | ((unsigned long)(fac)<<16) \
    | ((unsigned long)(code))) )Creates an HRESULT value from component pieces of the 32-bit value. Parameters 
    Sev 
    Severity code      Value     Definition 
    00        Success 
    01        Informational 
    10        Warning 
    11        Error Fac 
    The facility code. #define FACILITY_WINDOWS                 8
    #define FACILITY_URT                     19
    #define FACILITY_STORAGE                 3
    #define FACILITY_SSPI                    9
    #define FACILITY_SCARD                   16
    #define FACILITY_SETUPAPI                15
    #define FACILITY_SECURITY                9
    #define FACILITY_RPC                     1
    #define FACILITY_WIN32                   7
    #define FACILITY_CONTROL                 10
    #define FACILITY_NULL                    0
    #define FACILITY_MSMQ                    14
    #define FACILITY_MEDIASERVER             13
    #define FACILITY_INTERNET                12
    #define FACILITY_ITF                     4
    #define FACILITY_DISPATCH                2
    #define FACILITY_COMPLUS                 17
    #define FACILITY_CERT                    11
    #define FACILITY_ACS                     20
    #define FACILITY_AAF                     18Code 
    The facility's status code. See Also
    Structure of COM Error CodesRequirements 
      Windows NT/2000: Requires Windows NT 3.1 or later.
      Windows 95/98: Requires Windows 95 or later.
      Header: Declared in winerror.h.Built on Friday, September 08, 2000看到上面的Sev定义了吗? 是2位的,可在宏定义中Sev却右移了31位,这不是矛盾吗?
      

  5.   

    你这是什么版本的MSDN, 怎么跟我的不一样?我这里msdn上写的同littlepboy(vc小p孩), 同pomelowu(羽战士) ( )
      

  6.   

    我的是MSDN Library - January 2001
      

  7.   

    知道是怎么回事了,我的MSDN和微软网站上的不一样