COM Error - Programmer

This is a discussion on COM Error - Programmer ; I keep getting an error value returned in an HRESULT in the following code: HRESULT hr; IActiveDesktop *pActiveDesktop; //Create an instance of the Active Desktop hr = CoCreateInstance(CLSID_ActiveDesktop, NULL, CLSCTX_INPROC_SERVER, IID_IActiveDesktop, (void**)&pActiveDesktop); Since I am new to all this, I ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: COM Error

  1. COM Error

    I keep getting an error value returned in an HRESULT in the following
    code:

    HRESULT hr;
    IActiveDesktop *pActiveDesktop;

    //Create an instance of the Active Desktop
    hr = CoCreateInstance(CLSID_ActiveDesktop, NULL, CLSCTX_INPROC_SERVER,
    IID_IActiveDesktop, (void**)&pActiveDesktop);

    Since I am new to all this, I don't know how to convert the error
    number into something sensible. So, how does one convert an HRESULT
    into a sensible error message?

    Thanks.

    BTW, I think the value of hr that I get when I run the above code is
    496. If anyone knows off-hand what that is, please tell.

  2. Re: COM Error

    To turn an error index into something sensible,
    you can download MS platform sdk and search through
    the WinError.h file.

    Your error seems to be the following:

    // MessageId: CO_E_NOTINITIALIZED
    //
    // MessageText:
    //
    // CoInitialize has not been called.
    //
    #define CO_E_NOTINITIALIZED _HRESULT_TYPEDEF_(0x800401F0L)

    Note. 1F0 is hexademical for 496.


    "mfc" ???????/???????? ? ???????? ?????????:
    news:3599641a.0312120825.265b9d84@posting.google.c om...
    > I keep getting an error value returned in an HRESULT in the following
    > code:
    >
    > HRESULT hr;
    > IActiveDesktop *pActiveDesktop;
    >
    > //Create an instance of the Active Desktop
    > hr = CoCreateInstance(CLSID_ActiveDesktop, NULL, CLSCTX_INPROC_SERVER,
    > IID_IActiveDesktop, (void**)&pActiveDesktop);
    >
    > Since I am new to all this, I don't know how to convert the error
    > number into something sensible. So, how does one convert an HRESULT
    > into a sensible error message?
    >
    > Thanks.
    >
    > BTW, I think the value of hr that I get when I run the above code is
    > 496. If anyone knows off-hand what that is, please tell.




+ Reply to Thread