Jump to content
Sign in to follow this  

Kill a already exist Mutex

Recommended Posts



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
Return 0

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.