Sign in to follow this  
Followers 0
xFreakYx

Kill a already exist Mutex

1 post in this topic

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 :)

Share this post


Link to post
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
Sign in to follow this  
Followers 0