|
#include "stdafx.h"
#include "WaitInfo.h"
UINT WaitInfo::UWM_PROCESS_TERMINATED = ::RegisterWindowMessage(UWM_PROCESS_TERMINATED_MSG);
/****************************************************************************
* WaitInfo::requestNotification
* Inputs:
* HANDLE pr: Process handle
* CWnd * wnd: Window to notify on completion
* Result: void
*
* Effect:
* Spawns a waiter thread
****************************************************************************/
void WaitInfo::requestNotification(HANDLE pr, CWnd * wnd)
{
hProcess = pr;
notifyee = wnd;
AfxBeginThread(waiter, this);
} // WaitInfo::requestNotification
/****************************************************************************
* WaitInfo::waiter
* Result: void
*
* Effect:
* Waits for the thread to complete and notifies the parent
****************************************************************************/
void WaitInfo::waiter()
{
::WaitForSingleObject(hProcess, INFINITE);
notifyee->PostMessage(UWM_PROCESS_TERMINATED, 0, (LPARAM)hProcess);
} // WaitInfo::waiter
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.