title: Check for Named Event
body: <p>I have a process that creates a named event, using <code>::CreateEvent</code>.</p>
  
  <p>In my process, I want to check whether the event exists or not, but I don't want to create the event in case it doesn't exist. </p>
  
  <p>How can I do it?</p>
  
  <p>I can do it like this, but then the event will be created in case it doesn't exist:</p>
  
  <pre><code>HANDLE hEvent;
  hEvent= ::CreateEvent(NULL, FALSE, FALSE, _T("MyEvent"));
  if (::GetLastError() != ERROR_ALREADY_EXISTS)
  {
     .......
  }
  </code></pre>