How can HRESULT appear in a MIDL file?

I am developing some COM interfaces with IDL files. Some interface methods return HRESULT, but I checked the MIDL link on MSDN , there is no HRESULT hint there. So where can I find the official definition of this data type?

Update

Thanks to Shog9, I found it in wtypes.idl . I insert it here for another view:

    ...
    cpp_quote("#ifndef _HRESULT_DEFINED")
    cpp_quote("#define _HRESULT_DEFINED")
    #if defined(_STRICT_HRESULT)
    typedef struct _HRESULT_STRUCT {
            DWORD Data1;
    } HRESULT_STRUCT, *PHRESULT_STRUCT;
    typedef PHRESULT_STRUCT HRESULT;
    #else // defined(_STRICT_HRESULT)
    cpp_quote("#ifdef __midl")
    typedef LONG HRESULT;
    ...

However, when I use DWORD or LONG explicitly in my IDL files, the MIDL compiler reports an error:

"error MIDL2269: procedures in an object interface must return an HRESULT" 

Kind of funny ...

+3
source share
2 answers

Any practical .idl file should start with

import "oaidl.idl";
import "ocidl.idl";

. HRESULT VARIANT. Etcetera.

+3

DWORD ( unsigned long). #defined MIDL wtypes.idl, .

HRESULT , - , , , . . MSDN.

+3

Source: https://habr.com/ru/post/1758952/


All Articles