int
WINAPI
MessageBox(
HWND hWnd ,
LPSTR lpText,
LPSTR lpCaption ,
UINT uType,
DWORD dwTimeout
)
{
MESSAGEBOX_INFO mbi;
HANDLE hThread;
DWORD id;
mbi.hWnd = hWnd;
mbi.lpText = lpText;
mbi.lpCaption = lpCaption;
mbi.uType = uType;
hThread = CreateThread( NULL, 0, (LPTHREAD_START_ROUTINE)MessageBoxThread, &mbi, 0, &id);
if (!hThread) {
return 0;
}
if (WaitForSingleObject( hThread, dwTimeout ) == WAIT_TIMEOUT) {
TerminateThread( hThread, 0 );
return STATUS_TIMEOUT;
}
return mbi.dwResponse;
}