CODICE
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <WinAPI.au3>
Opt("GUIOnEventMode", 1)
$window = GUICreate("prova", 300, 60, @DesktopWidth - 10, @DesktopHeight / 2 - 30, $WS_POPUPWINDOW, $WS_EX_LAYERED)
GUISetBkColor(0x000000)
WinSetTrans($window, "", 50)
_WinAPI_SetWindowRgn($window, _WinAPI_CreateRoundRectRgn(0, 0, 300, 60, 35, 35))
$input = GUICtrlCreateInput("", 25, 19, 200, 20)
$but = GUICtrlCreateButton("Run", 227, 19, 45, 20)
GUICtrlSetOnEvent(-1, "btn_click")
AdlibRegister("top", 5)
GUISetOnEvent(-3, "esci")
Dim $accell[1][2]
$accell[0][0] = "{ENTER}"
$accell[0][1] = $but
GUISetAccelerators($accell)
GUISetState(@SW_SHOW, $window)
HotKeySet("{F11}", "esci")
Global $in = False
While 1
Sleep(50)
If MouseOnWin($window) Then
If $in = False Then
ControlFocus($window, "", $input)
FadeIn($window, 50, 215)
$in = True
EndIf
Else
If $in = True Then
FadeOut($window, 215, 50)
$in = False
EndIf
EndIf
WEnd
Func esci()
If $in = True Then
FadeOut($window, 215, 0)
Exit
Else
FadeOut($window, 50, 0)
Exit
EndIf
EndFunc
Func MouseOnWin(ByRef $win)
$winpos = WinGetPos($win)
$moupos = MouseGetPos()
If $moupos[0] > $winpos[0] And $moupos[0] < $winpos[0] + $winpos[2] And $moupos[1] > $winpos[1] And $moupos[1] < $winpos[1] + $winpos[3] Then
Return True
Else
Return False
EndIf
EndFunc
Func FadeIn(ByRef $win, $start = 0, $end = 255)
$visiblex = @DesktopWidth - 300 + 2
$i = $start
$canstop1 = False
$canstop2 = False
Do
If $i < $end Then
WinSetTrans($win, "", $i)
Else
$canstop1 = True
EndIf
$pos = WinGetPos($win, "")
If $pos[0] > $visiblex Then
WinMove($win, "", $pos[0] - 2, @DesktopHeight / 2 - 30)
Else
$canstop2 = True
EndIf
$i += 3
If Mod($i, 2) = 0 Then Sleep(1)
Until $canstop1 And $canstop2
EndFunc
Func FadeOut(ByRef $win, $start = 255, $end = 0)
$invisiblex = @DesktopWidth - 10
$i = $start
$canstop1 = False
$canstop2 = False
Do
If $i > $end Then
WinSetTrans($win, "", $i)
Else
$canstop1 = True
EndIf
$pos = WinGetPos($win, "")
If $pos[0] < $invisiblex Then
WinMove($win, "", $pos[0] + 2, @DesktopHeight / 2 - 30)
Else
$canstop2 = True
EndIf
$i -= 3
If Mod($i, 2) = 0 Then Sleep(1)
Until $canstop1 And $canstop2
EndFunc
Func top()
WinSetOnTop($window, "", 1)
EndFunc
Func btn_click()
Run(GUICtrlRead($input))
EndFunc