title: Allow only 3 instances of an application using semaphores
body: <p>I am trying to implement a simple routine using semaphores that will allow me to run only 3 instances of the application. I could use 3 mutexes but that is not a nice approach i tried this so far </p>
  
  <pre><code>var
    hSem:THandle;
  begin
    hSem := CreateSemaphore(nil,3,3,'MySemp3');
    if hSem = 0 then
    begin
      ShowMessage('Application can be run only 3 times at once');
      Halt(1);
    end;
  </code></pre>
  
  <p>How can i do this properly ?</p>