OpenMutex (kernel32)
Last changed: Tsahi-62.219.227.88

.
Summary

C# Signature:

[DllImport("kernel32.dll")]
static extern IntPtr OpenMutex(uint dwDesiredAccess, bool bInheritHandle,
   string lpName);

C# Const:

const UInt32 DELETE = 0x00010000;
const UInt32 READ_CONTROL = 0x00020000;
const UInt32 SYNCHRONIZE = 0x00100000;
const UInt32 WRITE_DAC = 0x00040000;
const UInt32 WRITE_OWNER = 0x00080000;
const UInt32 MUTEX_ALL_ACCESS = 0x1F0001;
const UInt32 MUTEX_MODIFY_STATE = 0x0001;

User-Defined Types:

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

        hMutex = OpenMutex(SYNCHRONIZE, false, MUTEX_NAME);
        if (hMutex == IntPtr.Zero)
        {
        //DestroySharedMemory();
        throw new Win32Exception();
        }

Alternative Managed API:

See System.Threading.Mutex in .NET Framework 1.1

Documentation
OpenMutex on MSDN