Function Reference


Opens an existing named semaphore object

#include <WinAPIProc.au3>
_WinAPI_OpenSemaphore ( $sSemaphore [, $iAccess = 0x001F0003 [, $bInherit = False]] )


$sSemaphore The name of the semaphore to be opened. Name comparisons are case sensitive.
$iAccess [optional] The access to the semaphore object. 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 one of the following values.
$bInherit [optional] Specifies whether inherites the handle by a processes, valid values:
True - The processes created by this process will inherit the handle.
False - The processes do not inherit this handle (Default).

Return Value

Success: The handle to the semaphore object.
Failure: 0, call _WinAPI_GetLastError() to get extended error information.


The function succeeds only if some process has already created the semaphore by using the _WinAPI_CreateSemaphore()
function. The calling process can use the returned handle in any function that requires a handle to
a semaphore object.



See Also

Search OpenSemaphore in MSDN Library.