Jump to content

Animated GUI


Bennet
 Share

Recommended Posts

Well... I've been sitting with this thing for a while now. You always see these rather interesting OS systems available for corporations in the movies. Nice screen savers, login screens and tool sets. So I was thinking it would be so much fun to simulate something like that. Unfortunately my knowledge on the design and creation of operating systems are very limited so I figured I'd settle for a software overlay on Windows. Now I'd like to find out if there is any way to easily do this. I've been searching the forums for different methods of adding animations, etc, to a dialog screen and finally settled on the AnimatedGIF method. Unfortunately you can't put Windows tools (input boxes, buttons, etc.) on top of the embedded explorer object, so I settled for creating a background picture box first before running the animation. Unfortunately this causes white flashes on the screen when it creates the embedded IE instance. Considering that my design is completely black this isn't really that highly appreciated.

Anyone got any suggestions of the steps I could follow to do something like this?

#include <IE.au3>
#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>

#region Basic GUI


$hGui = GUICreate("MyStuff", 818, 618, 156, 61)
GUISetBkColor(0x000000)
;===========================================Labels===================================================================================

GUISetFont(11, 300)
GUICtrlCreateLabel ("User ID", 320,200)
GUICtrlSetColor(-1,0xFFFED8)
GUICtrlSetBkColor(-1,0x000000)
GUICtrlCreateLabel ("Session ID", 320,230)
GUICtrlSetColor(-1,0xFFFED8)
GUICtrlSetBkColor(-1,0x000000)
GUICtrlCreateLabel ("Password", 320,260)
GUICtrlSetColor(-1,0xFFFED8)
GUICtrlSetBkColor(-1,0x000000)
;==========================================Inputs====================================================================================

$User = GUICtrlCreateInput ("", 405,200,100,20,$ES_LOWERCASE)
GUICtrlSetColor(-1,0xFFFED8)
GUICtrlSetBkColor(-1,0x000000)
$Session = GUICtrlCreateInput ("", 405,230,100,20,$ES_NUMBER)
GUICtrlSetColor(-1,0xFFFED8)
GUICtrlSetBkColor(-1,0x000000)
$Password = GUICtrlCreateInput ("", 405,260,100,20,$ES_PASSWORD)
GUICtrlSetColor(-1,0xFFFED8)
GUICtrlSetBkColor(-1,0x000000)

;==========================================Button====================================================================================

$Login = GUICtrlCreateButton ("Login", 365,300,100,20)
GUICtrlSetColor(-1,0xFFFED8)
GUICtrlSetBkColor(-1,0x000000)

$Background = GUICtrlCreatePic("E:\UmbrellaStart.jpg", 0, 0, 800, 600, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUISetState(@SW_SHOW)

#endregion



#region Main Loop
While 1
    $msg = GUIGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Login
        $gif = "E:\Umbrella.gif"
        _AnimatedGIF($gif)
    EndSelect
WEnd
#endregion



Func _AnimatedGIF(ByRef $gif)
    $oIE = ObjCreate("Shell.Explorer")
    $GUIActiveX = GUICtrlCreateObj($oIE, 0, 0, 800, 600)
    $oIE.navigate ("about:blank")
    While _IEPropertyGet($oIE, "busy")
        Sleep(100)
    WEnd
    $oIE.document.body.background = $gif
    $oIE.document.body.scroll = "no"
    GUISetState()
    
EndFunc
Link to comment
Share on other sites

Try this:

; If you don't want the background to display all over the GUI, replace 
;    "repeat" with "no-repeat center" on line 90.
; Watch out for overlapping controls where neither is disabled - understand that
;    there is no way to disable a control created with GUICtrlCreateObj.
#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#include <StaticConstants.au3>
#include <EditConstants.au3>
#include <IE.au3>
;
#region Basic GUI
;
Global $GUIActiveX, $oIE; probably these should be globals so you can delete them later.
$gif = "E:\Umbrella.gif"; you might as well define $gif here.
$hGui = GUICreate("MyStuff", 818, 618, 156, 61)
GUISetBkColor(0x000000)
;
;   || Label Controls  ||
;
GUISetFont(11, 300)
$lbl_01 = GUICtrlCreateLabel("User ID", 320, 200)
GUICtrlSetColor(-1, 0xFFFED8)
GUICtrlSetBkColor(-1, 0x000000)
$lbl_02 = GUICtrlCreateLabel("Session ID", 320, 230)
GUICtrlSetColor(-1, 0xFFFED8)
GUICtrlSetBkColor(-1, 0x000000)
$lbl_03 = GUICtrlCreateLabel("Password", 320, 260)
GUICtrlSetColor(-1, 0xFFFED8)
GUICtrlSetBkColor(-1, 0x000000)
;
;   || Input Controls ||
;
$User = GUICtrlCreateInput("", 405, 200, 100, 20, $ES_LOWERCASE)
GUICtrlSetColor(-1, 0xFFFED8)
GUICtrlSetBkColor(-1, 0x000000)
$Session = GUICtrlCreateInput("", 405, 230, 100, 20, $ES_NUMBER)
GUICtrlSetColor(-1, 0xFFFED8)
GUICtrlSetBkColor(-1, 0x000000)
$Password = GUICtrlCreateInput("", 405, 260, 100, 20, $ES_PASSWORD)
GUICtrlSetColor(-1, 0xFFFED8)
GUICtrlSetBkColor(-1, 0x000000)
;
;   || Button Control ||
;
$Login = GUICtrlCreateButton("Login", 365, 300, 100, 20)
GUICtrlSetColor(-1, 0xFFFED8)
GUICtrlSetBkColor(-1, 0x000000)
;
;   || Background Control ||
;
$Background = GUICtrlCreatePic("E:\UmbrellaStart.jpg", 0, 0, 800, 600, _
    BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS))
GUISetState(@SW_SHOW)
;
#endregion Basic GUI
;
#region Main Loop
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Login
            _AnimatedGIF($gif)
    EndSelect
WEnd
#endregion Main Loop
;
Func _AnimatedGIF(ByRef $gif)
    ;
    ; Either delete or disable and hide these controls if they are where the GIF is ...
    GUICtrlDelete($lbl_01)
    GUICtrlDelete($lbl_02)
    GUICtrlDelete($lbl_03)
    GUICtrlDelete($User)
    GUICtrlDelete($Session)
    GUICtrlDelete($Password)
    GUICtrlDelete($Login)
    GUICtrlDelete($Background)
    $oIE = ObjCreate("Shell.Explorer")
    $GUIActiveX = GUICtrlCreateObj($oIE, 0, 0, 800, 600)
    $oIE.navigate("about:blank")
    _IELoadWait($oIE)
    $oIE.document.parentwindow.offscreenBuffering = "true"
    $oIE.document.body.style.overflow = "hidden";$oIE.document.body.scroll = "no"
    $oIE.document.body.style.margin = "0px"
    $oIE.document.body.style.padding = "0px"
    ;
    ; CSS background reference:  http://www.w3schools.com/css/css_background.asp
    $oIE.document.body.style.background = "#000000 url(" & $gif & ") repeat"
    $oIE.document.body.style.border = "0px";"4px outset"
    GUISetState()
EndFunc   ;==>_AnimatedGIF
;

Edit: Code updated.

Edited by Squirrely1

Das Häschen benutzt Radar

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...