title: CreateMutex, OpenMutex and Process sync
body: <p>I'm trying to do the following:</p>
  
  <p>Process A should use OpenMutex to see if Process B is running.</p>
  
  <p>Process B should use CreateMutex to let Process A know it's running.
  Pretty simple actually...</p>
  
  <p>What happens is this:</p>
  
  <ol>
  <li>Run process A -> It sees that process B is not running. So far so good.</li>
  <li>Run process B -> It creates the mutex.</li>
  <li>Run process A again -> It sees that process B is now running. Still good.</li>
  <li>I close process B (which should close the mutex as well).</li>
  <li>Run process A -> It still sees that process B is running ! (OpenMutex does NOT fail).</li>
  </ol>
  
  <p>What am I doing wrong here ??</p>
  
  <p>Here is part of my code:</p>
  
  <pre><code>// Start of process B
  HANDLE hMutex = ::CreateMutex(NULL, TRUE, MY_MUTEX_NAME);
  MessageBox(NULL, _T("PROCESS B !"), _T("TEST"), 0); 
  CloseHandle(hMutex);
  // End of process B
  
  
  // Start of process A
  HANDLE hMutex = ::OpenMutex(SYNCHRONIZE, FALSE, MY_MUTEX_NAME);
  if(hMutex != NULL)
  {
     MessageBox(NULL, _T("PROCESS B is alive !"), _T("TEST"), 0); 
  }
  CloseHandle(hMutex);
  // End of process A
  </code></pre>