Jump to content

....


stuka
 Share

Recommended Posts

not the best 'popup' window code on the forum, but it's simple, smooth and it works

fades in as it slides in from right

slides and fades back to right on closing

semi-transparent and click throughable

compensates for taskbar height.

Edit: added variables for width and height

#include <GUIConstants.au3>

Opt("WinTitleMatchMode", 4)

HotKeySet ("{PAUSE}", "TogglePause")
Global $Paused = 0 ; Default is unpaused (0=off 1=on)
Local $GUIToaster, $text1 = "Tool Status"
Local $GUIToaster, $text2 = "Scan Paused"
Local $Pos, $i

Local $GuiW = 100 , $GuiH = 35 ; GuiCreate Width & Height

While 1 ; Main Message Loop
    $msg = GUIGetMsg()
    If $msg = -3 Then Exit
WEnd

Func TogglePause() ; hotkey pause function
    $Paused = NOT $Paused ;changes $Paused from 0 to 1 or from 1 to 0
    If $paused And Not WinExists("Tray Popup","") Then
        _HorzToaster()
        While $Paused ; while $Paused = 1
            Sleep(10); idle around (pause)
        WEnd
        For $i = 100 to 1 Step -1
            WinSetTrans($GUIToaster, "", $i*1.5)
            WinMove("Tray Popup","", $Pos[2]-$i, $Pos[3])
            Sleep(0) ; fast slide-out to right
        Next
        GUIDelete($GUIToaster)
    EndIf
EndFunc   ; TogglePause
    
Func _HorzToaster() ; incorporating code from Danny35d
    $Pos = WinGetPos("classname=Shell_TrayWnd")
    If $Pos[2] <> @DesktopWidth Then $Pos[2] = @DesktopWidth - $Pos[2]
    If $Pos[3] <> @DesktopHeight Then
        $Pos[3] = @DesktopHeight - ($Pos[3] + $GuiH)
    Else
        $Pos[3] -= $GuiH
    EndIf
    $GUIToaster = GUICreate ("Tray Popup", $GuiW, $GuiH, $Pos[2]-100, $Pos[3], _
    $WS_POPUP, BitOR ($WS_EX_TRANSPARENT, $WS_EX_LAYERED, $WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
    GUISetBkColor(0xFFFF00, $GUIToaster)
    $label1 = GUICtrlCreateLabel($text1, 0, 0, 100, 15,$SS_CENTER)
    GUICtrlSetFont(-1,11,800,1,"Arial")
    $label2 = GUICtrlCreateLabel($text2, 0, 17, 100, 30,$SS_CENTER)
    GUICtrlSetFont(-1,11,800,1,"Arial")
    GUICtrlSetColor($label2, 0xFF0000)
    WinSetTrans($GUIToaster, "", 0)
    Sleep(20)
    GUISetState(@SW_SHOW,$GUIToaster)
    For $i = 1 to 100
        WinSetTrans($GUIToaster, "", 1.5*$i)
        WinMove("Tray Popup","", $Pos[2]-$i, $Pos[3])
        Sleep(1) ; slow slide-in from right
    Next
EndFunc
Edited by rover

I see fascists...

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...