Date: 02-16-2022
Return to Index
created by gbSnippets
'Compilable Example: (Jose Includes)
#Compile Exe
#Dim All
#Include "Win32API.inc"
Global hDlg,hMutex As Dword
Function PBMain() As Long
Dialog New Pixels, 0, "Test Code",300,300,250,100, %WS_OverlappedWindow To hDlg
Control Add Button, hDlg, 100,"Create Mutex", 10,10,100,20
Control Add Button, hDlg, 200,"Release Mutex", 130,10,100,20
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
If Cb.Msg = %WM_Command And Cb.Ctl = 100 And Cb.CtlMsg = %BN_Clicked Then CreateM
If Cb.Msg = %WM_Command And Cb.Ctl = 200 And Cb.CtlMsg = %BN_Clicked Then ReleaseMutex(hMutex)
End Function
Sub CreateM
hMutex = CreateMutex(ByVal %Null, 0, "TestMutex")
WaitForSingleObject hMutex, %Infinite
? "bingo"
End Sub
http://www.garybeene.com/sw/gbsnippets.htm