Jump to content

Kill a already exist Mutex


Recommended Posts

Hello,

I'm trying to kill a already exist Mutex but it didn't really work for me.

Does someone know what I'm doing wrong?

$kill = _KillMutex("ThisIsATestMutex")
MsgBox (0,"Mutex",$kill)


Func _KillMutex ($szMutexName)
Local $hMutex = DllCall("Kernel32.dll", "hwnd", "OpenMutex", "int", 0x1F0001, "int", 1, "str", $szMutexName)
Local $aGLE = DllCall("Kernel32.dll", "int", "GetLastError")
If IsArray($aGLE) And $aGLE[0] = 127 Then
Local $aRM = DllCall("kernel32.dll", "int", "ReleaseMutex", "hwnd", $hMutex[0])
If IsArray($aRM) And $aRM[0] > 0 Then Return 1
Return -1
EndIf
Return 0
EndFunc

I hope someone of you can help me.

Thanks :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...