|This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.|
The most common way to terminate a process is to have it return from a WinMainfunction call. You can also terminate a process by having the primary thread of the process call the ExitThreadfunction. A Windows CE process automatically terminates if its primary thread is terminated, even if there are other active threads in existence for the process. ExitThreadreturns the exit code of the process. You can determine the exit code of a process by calling the GetExitCodeProcessfunction. Specify the handle to the process, which you can obtain by calling the CreateProcessor OpenProcessfunction; the function returns the exit code. If the process is still running, the function returns the STILL_ACTIVE termination status.
There are also other, less common, ways of terminating a process:
For more information on using interprocess communication to terminate a process, see Interprocess Synchronization.
Note A process immediately terminates if a related secondary thread generates an unhandled exception. This is a change in behavior from Windows CE version 2.10 or earlier.
Last updated on Tuesday, May 18, 2004