title: Abort entire application from thread in delphi
body: <p>I have a major problem with my delphi App.  I'm developing a software that uses external security. I'm using usb devices that must be connected to the users machine in order for my software to run. If by any chance the user removes this dongle, or starts without it, the app is supposed to warn the user and stop immediately.
  A thread is being released at the creation of the app, which checks for the security device. However, when the checks fail, e.g. no device found, that thread is not killing my app. I'm using something like this:  </p>
  
  <pre><code>    retCode := checkSecurity();
      if retCode = -1 then
      begin
          ShowMessage('Security device not found! Terminating immediately!');
          Application.Terminate;
      end;
  </code></pre>
  
  <p>The major problem here is that <code>Application.Terminate</code> doesn't really kill the app. I've read on SO and other places that the Terminate sends a signal for a gracefull shutdown and waits for other threads, in my case the main thread of the app, to finish. I really need to kill the app as mentioned, killing all threads and exiting, if possible, cleaning up to avoid memory leakage, but if not, fine with me.  I'm using Delphi XE2, developing with Windows 8.1.</p>
  
  <p>Any ideas?</p>