OpenWaitableTimer
[New
- Windows NT]
The OpenWaitableTimer
function returns a handle to an existing named waitable timer object.
HANDLE OpenWaitableTimer(
DWORD dwDesiredAccess, |
// access flag |
BOOL bInheritHandle, |
// inherit flag |
LPCTSTR lpTimerName |
// pointer to timer
object name |
); |
|
Parameters
dwDesiredAccess
Specifies the
requested access to the timer object. For systems that support object security,
the function fails if the security descriptor of the specified object does not
permit the requested access for the calling process.
This parameter
can be any combination of the following values:
Value |
Meaning |
TIMER_ALL_ACCESS |
Specifies
all possible access rights for the timer object. |
TIMER_MODIFY_STATE |
Enables use
of the timer handle in the SetWaitableTimerC26JBN and CancelWaitableTimer functions to modify the
timer s state. |
SYNCHRONIZE |
Enables use
of the timer handle in any of the wait functions |
bInheritHandle
Specifies
whether the returned handle is inheritable. If TRUE, a process created by the CreateProcess
lpTimerName
Points to a
null-terminated string specifying the name of the timer object. The name is
limited to MAX_PATH characters and can contain any character except the
backslash path-separator character (\). Name comparison is case sensitive.
Return Value
If the
function succeeds, the return value is a handle to the timer object.
If the
function fails, the return value is NULL. To get extended error information,
call GetLastError
Remarks
The OpenWaitableTimer
function enables multiple processes to open handles to the same timer object.
The function succeeds only if some process has already created the timer using
the CreateWaitableTimer
The returned
handle can be duplicated by using the DuplicateHandle function. Use the CloseHandle
function to close the handle. The system closes the handle automatically when
the process terminates. The timer object is destroyed when its last handle has
been closed.
See Also