title: Delphi and sleep function
body: <p>I am having some issues regarding the sleep function. I have my application which executes an external command with some options:</p>
  
  <pre><code>str := 'C:\BERN52\MENU\menu.exe C:\BERN52\GPS\PAN\DAILY.INP C:\GPSUSER52\WORK\MENUAUX_DAILY.INP';
  WinExec(Pansichar(str), SW_Shownormal);
  </code></pre>
  
  <p>After that when this process is finished I should kill it and continue with another things. I did the following:</p>
  
  <pre><code>Sleep(60000*StrToInt(Form1.Edit11.Text));
  winexec('taskkill /F /IM menu.exe', SW_HIDE);
  ...
  </code></pre>
  
  <p>This sleeping time can be 4 minutes but also can be 2 days.
  Of cause the main window going to the 'not responding' mode during this time. Could anyone suggest to me how to do this in a proper way?</p>