Sending in a bank with the value of 0 is not the same as sending in NULL.
Notice that in the userlib declaration, I changed the lpMutexAttributes paramter to be an int%, not a pointer*.
And the simple example code:
Thanks for the idea, it works great.
Notice that in the userlib declaration, I changed the lpMutexAttributes paramter to be an int%, not a pointer*.
.lib "Kernel32.dll" CreateMutex%(lpMutexAttributes%,bInitialOwner%,lpName$):"CreateMutexA" GetLastError%():"GetLastError"
And the simple example code:
Const ERROR_ALREADY_EXISTS=183 CreateMutex(0,1,"My Program Instance") ; Mutex accessible to any program If GetLastError() = ERROR_ALREADY_EXISTS Then Notify "My program is already running" ; Shutdown Else Notify "This is the only instance of My Program" ; OK EndIf
Thanks for the idea, it works great.