* ... create a thread here DECLARE GetExitCodeThread IN WIN32API LONG hThread, LONG @lpExitCode lnExitCode = 259 DO WHILE m.lnExitCode = 259 GetExitCodeThread( m.lnHandle, @lnExitCode ) * ... do something ENDDO CloseHandle( m.lnHandle )259 is the STILL_RUNNING exit code. If you only wait for the thread to end you could use the WaitForSingleObject() API function.