Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2008 Jan : HRESULT problem

www.cryer.info
Managed Newsgroup Archive

HRESULT problem

Subject:HRESULT problem
Posted by:"UlfH" (ulf_honkanen@nospam.umu.se)
Date:Fri, 18 Jan 2008 10:17:16

I am using a COM function that gives back a HRESULT value. The API help says
that the posible results are:

E_ACCESSDENIED  = $80070005;
E_INVALIDARG = $80070057;
E_OUTOFMEMORY = $8007000E;
VSS_E_BAD_STATE= $80042301;
VSS_E_OBJECT_NOT_FOUND = $80042308;
VSS_E_INVALID_XML_DOCUMENT = $80042311;

Now I'm calling the function and receiving the HRESULT. When analyzing the
result I do

case Res of
    E_ACCESSDENIED  : do something
    E_INVALIDARG: do some other thing;
    E_OUTOFMEMORY : do some other thing;
    VSS_E_BAD_STATE: do some other thing;
    VSS_E_OBJECT_NOT_FOUND : do some other thing;
    VSS_E_INVALID_XML_DOCUMENT: do some other thing;
else
    etc...

Works well but I'm getting 2 warnings:
[DCC Warning]  W1012 Constant expression violates subrange bounds
[DCC Warning]  W1018 Case label outside of range of case expression

I think that'äs because HRESULT is declared as a longint, so for example,
VSS_E_INVALID_XML_DOCUMENT will never get fired in my case. I really NEED to
analyze any posible case. How do I do? I have tried casting to a DWORD as in

case DWORD(Res) of

but this gives me an error.

Replies:

www.cryer.info
Managed Newsgroup Archive