ExitProcess

ExitProcess


在Windows CE中,终止一个进程最好是在WinMain函数中。

当Windows CE一个进程的主线程被终止,不管其余线程是否处于激活状态,该进程都会被终止。

This function ends a process and all of its threads.

VOID ExitProcess(
UINT uExitCode
);
Parameters
uExitCode
[in] Specifies the exit code for the process and for all threads that are terminated as a result of this call.

To retrieve the process's exit value, use the GetExitCodeProcess function.

To retrieve a thread's exit value, use the GetExitCodeThread function.

Return Values

None.

Remarks

This function is the preferred method of ending a process because it provides a clean process shutdown. This includes calling the entry-point function of all attached DLLs with a value indicating that the process is detaching from the DLL.

After all attached DLLs have executed a process termination value, this function terminates the current process.

The following actions are caused by terminating a process:

  • All object handles that were opened by the process are closed.
  • All threads in the process terminate their execution.
  • The state of the process object becomes signaled, satisfying threads waiting for the process to terminate.
  • The states of all threads of the process become signaled, satisfying threads waiting for the threads to terminate.
  • The termination status of the process changes from STILL_ACTIVE to the exit value of the process.

Terminating a process does not necessarily remove the process object from the OS. A process object is deleted when the last handle to the process is closed.

A process that is started as a result of a call by CreateProcess is run serially with the ExitProcess, ExitThread, and CreateThread functions. Within the parent process, only one of these events can happen in an address space at a time.

The following list shows the restrictions during the process:

  • During process startup and DLL initialization routines, new threads can be created, but they do not begin execution until DLL initialization is done for the process.
  • In a process, only one thread at a time can be in a DLL initialization or detach routine.
  • ExitProcess does not return to processes in the DLL initialization or detach routine.
Requirements

OS Versions: Windows CE 2.0 and later.
Header: Windows.h.
Link Library: Coredll.lib.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值