|
GetExitCodeProcess
The GetExitCodeProcess function retrieves the termination status of the specified process.
BOOL GetExitCodeProcess(
HANDLE hProcess, // handle to the process
LPDWORD lpExitCode // address to receive termination status
);
Parameters
hProcess - Identifies the process.
lpExitCode - Points to a 32-bit variable to receive the process termination status.
Return Values
성공하면 non-zero 실패하면 zero
Example
DWORD Result;
if ( Thread1 != NULL && GetExitCodeThread( Thread1->Handle, Result ) != 0 && Result == STILL_ACTIVE )
{
ShowMessage( "살아있다!" );
}
c++초보 님이 쓰신 글 :
: static unsigned __stdcall aaa(LPVOID lParam)
: {
: bbb * p = (bbb*)lParam;
:
: while(p->flag_p)
: {
: p->aProcess();
: Sleep(1);
: }
:
: _endthreadex(0);
:
: return 0;
: }
:
: pclose()
: {
: flag_p = flase;
: }
:
: _beginthreadex로 aaa쓰레드를 생성 한 후
: pclose()함수를 실행시켜 쓰레드의 조건을 변경하여 쓰레드를 종료시켰습니다.
: 여기서 궁금한 점은 _endthreadex(0)가 실행되어 쓰레드가 종료된걸 확인할수 있을가요?
|