Sign in to follow this  
Followers 0
iamtheky

SplashImage with Marquee and Tooltips

1 post in this topic

Always looking for more pro ways to mask install actions. This is my latest template using pieces from champak's stock ticker for the marquee.

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
#Include <Array.au3>
#include <IE.au3>
#Include <string.au3>
#include <GuiListView.au3>
#include <WinAPI.au3>
#include <GuiToolTip.au3>

Opt("GUIOnEventMode", 1)
Opt("GUICloseOnESC", 1)
GUISetOnEvent($GUI_EVENT_CLOSE, "GUI_CLOSE")

$log = FileOpen("C:\temp1\log.txt" , 9)
Dim $aARRAY[10]

$aARRAY[0] = "item 1"
$aARRAY[1] = "item 2"
$aARRAY[2] = "item 3"
$aARRAY[3] = "item 4"
$aARRAY[4] = "item 5"
$aARRAY[5] = "item 6"
$aARRAY[6] = "item 7"
$aARRAY[7] = "item 8"
$aARRAY[8] = "item 9"
$aARRAY[9] = "item 10"



$TickerString = _ArrayToString ($aARRAY , "  --->  ")

Global $symbol = $TickerString


    inetget("http://ftp.us.dell.com/utility/XPS_NB_1280x864_Red.jpg", "c:\temp1\Red.jpg", 1) ;installs the image if Ping Returns a Failure
    WinSetState("[CLASS:Shell_TrayWnd]", "", @SW_HIDE)
    SplashImageOn("", "c:\temp1\Red.jpg", @DesktopWidth, @DesktopHeight - 21, "", "", 1)



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-----TICKER SETUP---------------------------------------
Global $GUI_DOCKHORZ=$GUI_DOCKLEFT+$GUI_DOCKRIGHT
Global $GUI_DOCKMARQUEE=$GUI_DOCKHORZ+$GUI_DOCKHEIGHT
Global $TickerEntries,$TickerTimer, $TickerText, $REG

GUI_SetTicker()

$Form1 = GUICreate("Stock Ticker", @desktopwidth, 21, 0, @DesktopHeight - 21, $WS_POPUPWINDOW)

GUISetOnEvent($GUI_EVENT_CLOSE,'GUI_Close')
$Label1 = GUICtrlCreateLabel(" Loading Ticker... Please wait.", 0, 0, @desktopwidth, 21, -1, $WS_EX_STATICEDGE)
GUICtrlSetResizing(-1,$GUI_DOCKMARQUEE+$GUI_DOCKTOP)
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlSetBkColor(-1, 0x666666)
GUICtrlSetResizing(-1,$GUI_DOCKLEFT+$GUI_DOCKSIZE+$GUI_DOCKTOP)


_GDIPlus_Startup()
Global $hCtrl=ControlGetHandle($Form1,'',$Label1)
Global $gro
Global $grb
Global $gr
Global $hFamily = _GDIPlus_FontFamilyCreate ("Arial")
Global $hFont = _GDIPlus_FontCreate ($hFamily, 10, 2)
Global $tLayout
Global $hFormat = _GDIPlus_StringFormatCreate ()
Global $hBrush=_GDIPlus_BrushCreateSolid(0xFFCC0000)
Global $iMove=0
Global $gr_dim[4]=[0,0,0,0]

GUISetState(@SW_SHOW)
GUI_TickerSize()
GUIRegisterMsg($WM_SIZE, "WM_SIZE")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Ticker is Set;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;--------------------------------------



AdlibRegister ("_adlib_check", 1000)
AdlibRegister ("_adlib_move" , 25)



;;;;;;;;;;START OF INSTALL ACTIONS----------------------------------------------------------------------
ToolTip("Performing First Install Action", "", "", "Install Action", 1, 4)
sleep (3000)
FileWrite ($log, $aArray[0] &" Installed successfully or was already installed "& @CRLF)
ToolTip("Performing Second Install Action", "", "", "Install Action", 1, 4)
sleep (3000)
FileWrite ($log, $aArray[1] &" Installed successfully or was already installed "& @CRLF)
ToolTip("Performing Third Install Action", "", "", "Install Action", 1, 4)
sleep (3000)
FileWrite ($log, $aArray[2] &" Installed successfully or was already installed "& @CRLF)
ToolTip("Performing Fourth Install Action", "", "", "Install Action", 1, 4)
sleep (3000)
FileWrite ($log, $aArray[3] &" Installed successfully or was already installed "& @CRLF)
ToolTip("Performing Fifth Install Action", "", "", "Install Action", 1, 4)
sleep (3000)
FileWrite ($log, $aArray[4] &" Installed successfully or was already installed "& @CRLF)
ToolTip("Performing Sixth Install Action", "", "", "Install Action", 1, 4)
sleep (3000)
FileWrite ($log, $aArray[5] &" Installed successfully or was already installed "& @CRLF)
ToolTip("Performing Seventh Install Action", "", "", "Install Action", 1, 4)
sleep (3000)
FileWrite ($log, $aArray[6] &" Installed successfully or was already installed "& @CRLF)
ToolTip("Performing Eigth Install Action", "", "", "Install Action", 1, 4)
sleep (3000)
FileWrite ($log, $aArray[7] &" Installed successfully or was already installed "& @CRLF)
ToolTip("Performing Ninth Install Action", "", "", "Install Action", 1, 4)
sleep (3000)
FileWrite ($log, $aArray[8] &" Installed successfully or was already installed "& @CRLF)
ToolTip("Performing Tenth Install Action", "", "", "Install Action", 1, 4)
sleep (3000)
FileWrite ($log, $aArray[9] &" Installed successfully or was already installed "& @CRLF)
;;;;;;;;;;;END OF INSTALL ACTIONS----------------------------------------------------------------------

GUI_CLOSE()


Func _adlib_move ()
        GUI_DrawTicker('Items will be processed in the Following Order: '&$Symbol&' ..... Please Wait.')
        Sleep(10)
        $iMove+=1
 endFunc

 Func GUI_SetTicker()
    Global $TickerEntries, $TickerTimer, $TickerText
    $TickerTimer=0
    $TickerEntries=''
    $TickerText=''
    $TickerEntries=StringSplit($TickerText , 'K')
EndFunc

;;;;;;;;;;;;;;;-------------FUNCTION FOR Ticker SIZE--------------;;;;;;;;;;;;;;;;;;;;;
Func GUI_TickerSize()
    Global $gro, $grb, $gr_dim
    $gr_dim=ControlGetPos($Form1,'',$Label1)
    ConsoleWrite('TickerResize '&$gr_dim[2]&@CRLF)
    Local $cgp=$gr_dim

    If $gro Then _GDIPlus_GraphicsDispose($gro)
    $gro=_GDIPlus_GraphicsCreateFromHWND($hCtrl)

    If $gr Then _GDIPlus_GraphicsDispose($gr)
    If $grb Then _GDIPlus_BitmapDispose($grb)
    $grb=_GDIPlus_BitmapCreateFromGraphics($cgp[2],$cgp[3],$gro); I'd only make one - but the darn thing has to resize!
    $gr=_GDIPlus_ImageGetGraphicsContext($grb)
EndFunc
;;;;;;;;;;;;;;;-------------END of FUNCTION FOR Ticker SIZE--------------;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;-------------FUNCTION FOR Ticker CLOSE--------------;;;;;;;;;;;;;;;;;;;;;
Func GUI_Close()

    If InetGetInfo() Then InetGet('abort')

    $TickerTimer=0
    $TickerEntries=''
    $TickerText=''

    $tLayout=0
    If $hFamily Then _GDIPlus_FontFamilyDispose($hFamily)
    If $hFont Then _GDIPlus_FontDispose($hFont)
    If $hFormat Then _GDIPlus_StringFormatDispose($hFormat)
    If $hBrush Then _GDIPlus_BrushDispose($hBrush)
    If $gr Then _GDIPlus_GraphicsDispose($gr)
    If $grb Then _GDIPlus_BitmapDispose($grb)
    If $gro Then _GDIPlus_GraphicsDispose($gro)

    GUISetState(@SW_HIDE)
    GUIDelete($Form1)
    WinSetState("[CLASS:Shell_TrayWnd]", "", @SW_SHOW)
    splashoff()     ;takes down the pretty picture
    FileClose($log)
    sleep (500)
run ("notepad.exe " & "c:\temp1\log.txt")
FileDelete ("c:\temp1\updating.bmp")                                                ;deletes the picture from c:\temp1
                                            ;displays the log
    Exit
EndFunc
;;;;;;;;;;;;;;;-------------END FUNCTION FOR Ticker CLOSE--------------;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;-------------FUNCTION FOR WINDOW SIZE--------------;;;;;;;;;;;;;;;;;;;;;
Func WM_SIZE($hWnd, $Msg, $wParam, $lParam)
    GUI_TickerSize()
    Return $GUI_RUNDEFMSG
EndFunc
;;;;;;;;;;;;;;;-------------END of FUNCTION FOR WINDOW SIZE--------------;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;-------------FUNCTION FOR Ticker DRAW--------------;;;;;;;;;;;;;;;;;;;;;
Func GUI_DrawTicker($str)
    Global $gr_dim,$iMove
    Local $cgp=$gr_dim

    If $iMove>$cgp[2] Then
        ConsoleWrite('TickerBack '&$iMove&'>'&$cgp[2]&@CRLF)
        $iMove=0
    EndIf
    _GDIPlus_GraphicsClear($gr,0xFF999999)

    $tLayout = 0
    $tLayout = _GDIPlus_RectFCreate ($iMove,0, $cgp[2], $cgp[3])
    _GDIPlus_GraphicsDrawStringEx ($gr, $str, $hFont, $tLayout, $hFormat, $hBrush)

    $tLayout = 0
    $tLayout = _GDIPlus_RectFCreate ($iMove-$cgp[2],0, $cgp[2], $cgp[3])
    _GDIPlus_GraphicsDrawStringEx ($gr, $str, $hFont, $tLayout, $hFormat, $hBrush)

    _GDIPlus_GraphicsDrawImageRect($gro, $grb, 0, 0, $cgp[2], $cgp[3]);copy to bitmap
EndFunc
;;;;;;;;;;;;;;;-------------END FUNCTION FOR Ticker DRAW--------------;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;Function to handle the "Microsoft Certificate Services" error:::::::::::::::::::::::
func _adlib_check()
    local $wintitle = "Microsoft Certificate Services"          ;sets the variable to the window title
    ; activate the window if it exists
    if winexists ($wintitle) and not winactive ($wintitle) then   ;if any windows exist with that title and are not active then
        winactivate ($wintitle)                                     ;activate the window
        sleep (500)                                                 ;wait half a second
    endif
    ; send enter if the window is active
    if winactive ($wintitle) then                               ;if a window is active with that title
        send ("{enter}")                                        ;send enter (which clicks ok)
        sleep (1000)                                            ;wait a second
    endif
endfunc
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;==>RFunction for the "Microsoft Certificate Services" error

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
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
Sign in to follow this  
Followers 0