This topic is 4878 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Hi everyone, Does anyone know where I can find a reference to all the Win32 Thread exit codes? Visual Studio displays them after you finish debugging, but unfortunately the error codes themselves are fairly cryptic. I'm pretty sure anything other than '0' is bad, but what do the others mean? Thanks in advance.

Share on other sites
I couldn't find a table or anything, but one thing you may want to look into is using the GetLastError function in order to get the last error and display it. You will have to work with that function some for it is meant to exit a process, but if you use those concepts, you should be able to get the error information. One idea, not sure if it'll work.

Share on other sites
With visual studio a handy tool ships: 'errlook.exe'. It allows you to type in a program exit code and gives you the description of the error. I'm not sure if it works for thread exit codes but they might be just the same. If you have visual studio look in
Microsoft Visual Studio\Common\Tools

See if you can find it or, otherwise, I might send it to you. There also may be similar tools available online.

Greetz,

Illco

Share on other sites
Thread exit codes and error codes are completely different things... For error codes you can use some tool like suggested above or you can just look in winerror.h (for most things).

The exit code returned by a thread is up to the app. It could mean anything.

Share on other sites
Handy tip for MSVC (unrelated to thread return values):

1) place a breakpoint on the line immediately after any Win32 function that returns errors via GetLastError() and run your app in the debugger.

2) In the Watch window of the debugger, enter a new watch name: @err,hr

3) voila! - the "@err" part calls GetLastError() and the ",hr" part translates the error code to a message string.

The ",hr" thing can be used to translate specific error codes or variables too (e.g. "201,hr" or "nResult,hr").

Share on other sites
Quote:
 Does anyone know where I can find a reference to all the Win32 Thread exit codes?

Jans.

Share on other sites
Pity they do not run exactly in parallel to program exit code. However the following:
Quote:
 The exit code returned by a thread is up to the app. It could mean anything.

Quote:
 You set them yourself when your thread terminates [...]. The values are otherwise meaningless...

is some sloppy argumentation. A program can also return anything it likes as specified by the programmer -- but that does not mean there is no actual meaning in the usual interpretation. Unfortunately, there is no such default interpretation for thread exit codes besides
- zero signifies success
- non-zero signifies a problem
- If a thread happens to return STILL_ACTIVE (259) as an error code, applications that test for this value could end up in an infinite loop. (MSDN)

Greetz

Illco

1. 1
2. 2
Rutin
18
3. 3
4. 4
5. 5
frob
12

• 9
• 21
• 12
• 9
• 17
• Forum Statistics

• Total Topics
632606
• Total Posts
3007384

×