Re: SetMenu & GetLastError

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: Gary Chanson (gchanson_at_No.Spam.TheWorld.net)
Date: 07/20/04


Date: Mon, 19 Jul 2004 20:13:00 -0400


"Tassilo" <nix@nothing.net> wrote in message
news:OKze6JebEHA.2908@TK2MSFTNGP10.phx.gbl...
> Well, thank you for the simple answer !
> It is perfectly clear that the value of GetLastError() is undefined if
> everything seems to be ok (and the function didn't return an error). But
> inside SetMenu, there is something setting a new error value on the error
> stack (in the case mentioned in the original post), and I would like to
know
> why.
>
> Can you tell me perhaps if it is for sure, that the value of GetLastError
is
> undefined as long as a function returns success ? I can't find such a
> statement in the MSDN, so I am a bit sceptical about this.

    From MSDN:

Return Values
    If the function succeeds, the return value is nonzero.
    If the function fails, the return value is zero. To get extended error
information, call GetLastError.

    The value of GetLastError is not defined for the success case. This is
the way MSDN always documents such cases.

    It's irrelevant that a low level function might return an error as long
as it doesn't prevent SetMenu from succeeding.

-- 
-GJC [MS Windows SDK MVP]
-Software Consultant (Embedded systems and Real Time Controls)
- http://www.mvps.org/ArcaneIncantations/consulting.htm
-gchanson@mvps.org


Relevant Pages

  • Re: problems accessing compact flash card
    ... > MSDN says of CreateFile, ... > extended error information, call GetLastError." ...
    (comp.lang.pascal.delphi.misc)
  • Re: SetMenu & GetLastError
    ... stack (in the case mentioned in the original post), and I would like to know ... Can you tell me perhaps if it is for sure, that the value of GetLastError is ... undefined as long as a function returns success? ... statement in the MSDN, so I am a bit sceptical about this. ...
    (microsoft.public.win32.programmer.ui)
  • Re: CreateWindowEx for RICHEDIT_CLASS returns ERROR_ACCESS_DENIED
    ... MSDN: "If the function fails, ... To get extended error information, ... It is perhaps not very clear, but it also means do not call GetLastError unless the function returns NULL. ...
    (microsoft.public.vc.language)
  • Re: a synchronization issue - jusy for you guys
    ... CreateEvent: ... If the function succeeds, the return value is a handle to the event ... the function returns a handle to the existing object and GetLastError ... To get extended error ...
    (comp.lang.pascal.delphi.misc)
  • Re: CreateDIBSection question
    ... >>>` If the function succeeds, the return value is a handle to the newly ... >I have any error message or returned by GetLastError and i think the problem ... But if the system has multiple monitors, ... Sev ...
    (microsoft.public.win32.programmer.gdi)