|
|
| Ecco il codice CODICE #NoTrayIcon #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3>
$in1 = "" $in2 = "" $last = ""
$Form1 = GUICreate("Algoritmo di Peterson", 318, 98, 192, 124) $Button1 = GUICtrlCreateButton("Processo #1", 16, 24, 121, 49) $Button2 = GUICtrlCreateButton("Processo #2", 176, 24, 121, 49) GUISetState(@SW_SHOW, $Form1)
While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 Processo1 () Case $Button2 Processo2 () EndSwitch WEnd ;processo #1 Func Processo1 () $in1 = True $last = 1 $in2 = False While 1 If BitAND ($in2 = False, $last = 1) Then MsgBox (0,"Processo #1","Il processo #1 è entrato nella sezione critica!",5) ExitLoop EndIf WEnd $in1 = False MsgBox (0,"Processo #1","Il processo #1 è entrato nella sezione non critica!",5) EndFunc ;processo #2 Func Processo2 () $in2 = True $last = 2 $in1 = False While 1 If BitAND ($in1 = False, $last = 2) Then MsgBox (0,"Processo #2","Il processo #2 è entrato nella sezione critica!",5) ExitLoop EndIf WEnd $in2 = False MsgBox (0,"Processo #2","Il processo #2 è entrato nella sezione non critica!",5) EndFunc Ecco il Download | Qui!|
|
| |