Voici le programme Piano
Code : Tout sélectionner
#include <GUIConstantsEx.au3>
HotKeySet("{F1}", "F1")
HotKeySet("{F2}", "F2")
HotKeySet("{F3}", "F3")
HotKeySet("{F4}", "F4")
HotKeySet("{F5}", "F5")
HotKeySet("{F6}", "F6")
HotKeySet("{F7}", "F7")
HotKeySet("{F8}", "F8")
HotKeySet("{F9}", "F9")
HotKeySet("{F10}", "F10")
#Region ### START Koda GUI section ### Form=
$FORM1 = GUICreate("DBSabata's Piano", 408, 106, 256, 155)
$C1 = GUICtrlCreateButton("F1", 8, 8, 33, 81, 0)
$D1 = GUICtrlCreateButton("F2", 48, 8, 33, 81, 0)
$E1 = GUICtrlCreateButton("F3", 88, 8, 33, 81, 0)
$F1 = GUICtrlCreateButton("F4", 128, 8, 33, 81, 0)
$G1 = GUICtrlCreateButton("F5", 168, 8, 33, 81, 0)
$A1 = GUICtrlCreateButton("F6", 208, 8, 33, 81, 0)
$B1 = GUICtrlCreateButton("F7", 248, 8, 33, 81, 0)
$C2 = GUICtrlCreateButton("F8", 288, 8, 33, 81, 0)
$D2 = GUICtrlCreateButton("F9", 328, 8, 33, 81, 0)
$E2 = GUICtrlCreateButton("F10", 368, 8, 33, 81, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$NMSG = GUIGetMsg()
If $NMSG = $C1 Then Call("F1")
If $NMSG = $D1 Then Call("F2")
If $NMSG = $E1 Then Call("F3")
If $NMSG = $F1 Then Call("F4")
If $NMSG = $G1 Then Call("F5")
If $NMSG = $A1 Then Call("F6")
If $NMSG = $B1 Then Call("F7")
If $NMSG = $C2 Then Call("F8")
If $NMSG = $D2 Then Call("F9")
If $NMSG = $E2 Then Call("F10")
Switch $NMSG
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func F1()
Beep(264, 500)
EndFunc ;==>F1
Func F2()
Beep(297, 500)
EndFunc ;==>F2
Func F3()
Beep(330, 500)
EndFunc ;==>F3
Func F4()
Beep(352, 500)
EndFunc ;==>F4
Func F5()
Beep(396, 500)
EndFunc ;==>F5
Func F6()
Beep(440, 500)
EndFunc ;==>F6
Func F7()
Beep(495, 500)
EndFunc ;==>F7
Func F8()
Beep(523.3, 500)
EndFunc ;==>F8
Func F9()
Beep(535, 500)
EndFunc ;==>F9
Func F10()
Beep(595, 500)
EndFunc ;==>F10
► Afficher le texte