OpenEvent

  HANDLE OpenEvent(fdwAccess, fInherit, lpszName)    
  DWORD fdwAccess; /* desired access flag */
  BOOL fInherit; /* will child process inherit? */
  LPTSTR lpszName; /* name of the event */

The OpenEvent function returns a handle for an existing named event object.

Parameters

fdwAccess

Specifies the desired access to the event object. For NT/Win32, this access is checked against any security descriptor on the target event.

This parameter can have some combination of the following values:

Value Meaning

EVENT_MODIFY_STATE  
  Specifies modify state access (release) to the event.
SYNCHRONIZE  
  Specifies synchronization access (wait) to the event.
EVENT_ALL_ACCESS  
  Specifies all possible access flags for the event.

fInherit

Specifies whether the returned handle will be inherited by a new process created by the current process. A value of TRUE indicates that the new process will inherit the handle.

lpszName

Pointer to a null-terminated string that names the event to be opened.

Return Value

If the function is successful, the return value is an open handle to the specified event. Otherwise, the return value is NULL. Use the GetLastError function to obtain extended error information.

Comments

The OpenEvent function succeeds if the named event exists and the security descriptor for the event allows the access requested by the fdwAccess parameter.

If the function is successful, the handle is granted access to the event object only to the extent requested by the fdwAccess parameter.

The handle returned by the OpenEvent function may be used with any function that requires a handle to an event object.

The OpenEvent function may be used as either a wide-character function (where text arguments must use Unicode) or an ANSI function (where text arguments must use characters from the Windows 3.x character set installed).

See Also

CreateEvent, CloseHandle, WaitForSingleObject, WaitForMultipleObjects