codice:
#include <GUIConstants.au3>
#include <StaticConstants.au3>
#include <guiedit.au3>
#include <WindowsConstants.au3>
Global $ptlcd, $ptled, $dif, $risp, $an
$calcolatrice = GUICreate("Calcolo consumo", 351, 400,-1,-1)
$valore1 = GUICtrlCreateInput("", 50, 20, 100, 21)
$valore2 = GUICtrlCreateInput("", 50, 60, 100, 21)
$valore3 = GUICtrlCreateInput("", 50, 100, 100, 21)
$valore4 = GUICtrlCreateInput("", 50, 140, 100, 21)
$valore5 = GUICtrlCreateInput("", 50, 180, 100, 21)
$somma = GUICtrlCreateButton("Calcola", 264, 240, 65, 25, $WS_GROUP)
$formato = GUICtrlCreateCombo("Estensione", 256, 208, 73, 25)
$formatov = GUICtrlSetData(-1, "26|32|42")
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
case $somma
_Somma ($valore1,$valore2,$valore3,$valore4,$valore5,$formatov)
$ptlcd = GUICtrlCreateLabel($ptlcd, 0, 300, 350, 17, $SS_CENTER)
$ptled = GUICtrlCreateLabel($ptled, 0, 400, 350, 17, $SS_CENTER)
$dif = GUICtrlCreateLabel($dif, 0, 500, 350, 17, $SS_CENTER)
$risp = GUICtrlCreateLabel($risp, 0, 600, 350, 17, $SS_CENTER)
$an = GUICtrlCreateLabel($an, 0, 700, 350, 17, $SS_CENTER)
GUICtrlSetFont(-1, 8, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
EndSwitch
WEnd
Func _Somma ($var1,$var2,$var3,$var4,$var5,$formatov)
$vr1 = GUICtrlRead ($var1)
$vr2 = GUICtrlRead ($var2)
$vr3 = GUICtrlRead ($var3)
$vr4 = GUICtrlRead ($var4)
$formatov = GUICtrlRead ($formatov)
$vr5 = GUICtrlRead ($var5)
$ptlcd=(($formatov*$vr4*330)/1000)
$ptled=((($formatov-(($formatov/100)*40))*$vr4*330)/1000)
$dif=$ptlcd-$ptled
$risp=$dif*$vr5
$an=round(($ptlcd-$ptled-$vr3)/$risp)
EndFunc
Grazie