Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

Search Results for "CreateMutex" in [All]

coredll

.
Summary
.

public static extern int CreateMutex(IntPtr lpMutexAttributes, bool bInitiaOwner, string lpName);

.

        CreateMutex(IntPtr.Zero, true, "<Application Name>"); // to be replaced by the name of your application

.
Documentation
[CreateMutex] on MSDN

kernel32

.
Summary
.

static extern IntPtr CreateMutex(IntPtr lpMutexAttributes, bool bInitialOwner,

.

    Public Function CreateMutex(ByVal lpMutexAttributes As IntPtr, _

.

Here's how I use CreateMutex() to prevent more than one instance of my application from running at any given time.

.

        public static extern IntPtr CreateMutex( IntPtr lpMutexAttributes,

.

        /// This value can be returned by CreateMutex() and is found in

.

            // create IntPtrs for use with CreateMutex()

.

                ipHMutex = Win32Calls.CreateMutex( ipMutexAttr,

.

                {    // CreateMutex() failed.

.

        /// This value can be returned by CreateMutex() and is found in

.

        public static extern IntPtr CreateMutex(IntPtr lpMutexAttributes, bool bInitialOwner, string lpName);

.

            mutex.Handle = InternalCreateMutex( initiallyOwned, name, out createdNew );

.

        private static IntPtr InternalCreateMutex( bool initiallyOwned, string name, out bool createdNew )

.

                    hMutex = Native.CreateMutex( mutexAttributesPtr, initiallyOwned ? true : false, name );

.
Documentation
[CreateMutex] on MSDN

 
Access PInvoke.net directly from VS: