GetLastError is not retuning correct error ID. 
Author Message
 GetLastError is not retuning correct error ID.

OK,
I tried that too ReturnValue=GetWindowRect(-1,&Rect)
My ReturnValue is 0. Which means it failed.
It didn't work anyway.

Here  is the catch.
I was using WIN98 second edition.
I tried on NT machine. Guess what?
GetLastError()  returns correct ID.
After that I tried on another WIN98 machine and it did not return correct
ID.
This is GetLastError()  reference page from MSDN
***********************************************************
Most functions in the Win32 API that set the thread's last error code value
set it when they fail; a few functions set it when they succeed. Function
failure is typically indicated by a return value error code such as zero,
NULL, or -1. Some functions call SetLastError under conditions of success;
those cases are noted in each function's reference page.

Windows 95/98: Because SetLastError is a 32-bit function only, Win32
functions that are actually implemented in 16-bit code do not set the
last-error code. You should ignore the last-error code when you call these
functions. They include window management functions, GDI functions, and
Multimedia functions.
************************************************************
Even though GetWindowRect reference page says "If the function fails, the
return value is zero. To get extended error information, call GetLastError."
However, my assumsion is GetWindowRect and some of the win32 call in 98
machine arenot supported by GetLastError() .

Thanks.

Quote:
> I intentionally sent invalid window handle on: "GetWindowRect(0,&Rect);"
and
> then try to test my error handle is working correctly like this

matMessage(
>      FORMAT_MESSAGE_ALLOCATE_BUFFER |
>      FORMAT_MESSAGE_FROM_SYSTEM |
>      FORMAT_MESSAGE_IGNORE_INSERTS,
>      NULL,
>      GetLastError(),
>      MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
>      (LPTSTR) &lpMsgBuf,
>      0,
>      NULL
>      );

> However, GetLastError() retunr

s 0 which is ERROR_SUCCESS--The operation completed successfully.

- Show quoted text -

Quote:

> Shouldn't it retun error:1400 ERROR_INVALID_WINDOW_HANDLE--Invalid window
handle ?

> Thanks in advance.

> -Boo



Tue, 19 Aug 2003 03:24:33 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. GetLastError is not retuning correct error ID.

2. GetLastError is not retuning correct error ID.

3. GetLastError is not retuning correct error ID.

4. GetLastError is not retuning correct error ID.

5. GetLastError is not retuning correct error ID.

6. GetLastError is not retuning correct error ID.

7. GetLastError is not retuning correct error ID.

8. Why am I not getting correct position?

9. Correct ID resource ?

10. Where do I find the id of the printer I am using

11. Update error - Input string was not in a correct format

12. Input string is not in correct format error:

 

 
Powered by phpBB® Forum Software