Runner

« Older   Newer »
  Share  
/dev/random
CAT_IMG Posted on 6/2/2011, 15:45     +1   -1




Ecco la mia ultima cazzata: una piccola GUI dalla grafica simpatica che runna il programma che inserisci.
Più che altro era per creare la GUI, la funzionalità in sé è una cagata xD

SPOILER (click to view)
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
 
Top
xMasteRx
CAT_IMG Posted on 6/2/2011, 15:50     +1   -1




hai copiato l'idea del mio smp XXXD
 
Top
/dev/random
CAT_IMG Posted on 6/2/2011, 15:54     +1   -1




Sì in effetti mi sono ispirato a quello, ma l'ho riscritto tutto d'accapo ù.ù xD
Il mio comunque non si può trascinare su e giù xD
 
Top
xMasteRx
CAT_IMG Posted on 6/2/2011, 15:55     +1   -1




giusto XD ma metti una animazione di triangolo che gira con le GDI+ e sei apposto XD
 
Top
/dev/random
CAT_IMG Posted on 6/2/2011, 15:56     +1   -1




lol non mi piace
 
Top
4 replies since 6/2/2011, 15:45   155 views
  Share