It appears you still don't understand.
Most WinAPI functions do not set an error code when they succeed.
That means when you call GetLastError() you get the last value that was set by a function that did set the error code.
It's the same in VC6, except that the last error code happens to be 0 instead of 1133.
You said this earlier:
I think I got it about the preferred way of calling functions and error checking.
and this:
now the user says: "hey, I've done anything yet, and I'm wrong, with error code 1113."
MinGW say: "you're not wrong, you should check yourself in a better way, check the return value first, then the error code"
user say: "That's my habbit, it always work with VC"
But that is not the "preferred way", it's the only correct way. You can't call GetLastError() when the function was successful, BECAUSE YOU'LL GET THE RESULT OF SOME RANDOM PREVIOUS WINAPI CALL. Got it now?
Edit: and just so it is clear: that applies to all compilers (including compilers for languages other than C++).
I do respect all the answers, I think this thread will always come to my mind when I write some about error checking. I just cannot believe that a compiler would add some limitation to user, but I will accept that cause I have to.
I just cannot believe that a compiler would add some limitation to user
There is no limitation here. If you still think that, you'll have to read the thread again. And again if necessary.
In any case, this will be my last reply to this thread. Good luck.