Jump to content

..Loading..


_Kurt
 Share

Recommended Posts

Hey,

This gives people something to look at while something is loading. Pick your favorite loading bar with 15 GIFs to choose from. I recently made it more of a ProgressOn/ProgressOff type of thing. Also, if you do not like lugging around picture folders with your program, no problem, you can use the URL instead! Credits go to Larry for CreatePolyRgn(), Gafrost for non-scrolling gifs (he mentionned it somewhere), and Valuater for his help.

Kurt

-= UPDATE =-

* Added 15 Loading GIFs to choose from!

* Added LoadingOff()

* Added parameter for function to be loaded

* Added ConsoleWrite's for errors

* Small modification on $location parameter

=========

Previous Downloads - 60 :P

Edited by _Kurt

Awaiting Diablo III..

Link to comment
Share on other sites

Not bad!!!

added timer

#include <GUIConstants.au3>

;Uncomment one of the following to test the example
Global $begin = TimerInit()
Global $wait = 5000

;;  EXAMPLE 1  ;;
;Pic # 1, gif must be saved in a folder
LoadingOn("", 1, @ScriptDir & '\Pics\loading1.gif')

;;  EXAMPLE 2  ;;
;Pic # 2, gif must be saved in a folder
;LoadingOn("", 2, @ScriptDir & '\Pics\loading2.gif')

;;  EXAMPLE 3  ;;
;Pic # 1, gif found by URL
;LoadingOn("", 1, 'URL')

;;  EXAMPLE 4  ;;
;Pic # 2, gif found by URL
;LoadingOn("", 2, 'URL')


;===============================================================================
;
; Function Name:    LoadingOn()
; Description:      Create A Loading Bar
; Parameter(s):     $name     - Name of GUI
;                   $num      - Which type of Loading bar (1 or 2)
;                   $location - Location of GIFs (URL can also be used, see examples)
; Requirement(s):   If URL is used, Internet access.
; Return Value(s):  @ERROR = 1
; Author(s):        _Kurt (& Larry & Gafrost)
;
;===============================================================================

Global $name, $GUI, $location, $num


Func LoadingOn($name, $num, $location)
    If $num = 1 Then
        $w = 115
        $h = 165
        $w2 = -50
        $h2 = -30
        $l2 = 300
        $r2 = 200
    EndIf
    If $num = 2 Then
        $w = 145
        $h = 23
        $w2 = -10
        $h2 = -20
        $l2 = 170
        $r2 = 100
    EndIf
    If $location = "URL" AND $num = 1 Then $location = "https://njgin.state.nj.us/oit/gis/NJ_NJGINExplorer/images/loadingPage.gif"
    If $location = "URL" AND $num = 2 Then $location = "http://www.autogericke.de/images/loadingBar.gif"
    $GUI = GUICreate($name,$w,$h,-1,-1,$ws_popup, 0x00000020)
    GUICtrlSetState(-1, $GUI_DISABLE)
    GUISetIcon(@SystemDir & '\shell32.dll', 165)
    ;GUISetBkColor(0xFFFFFF)
    $a = CreatePolyRgn("")
    $b = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $GUI, "long", $a, "int", 1)
    $oIE = ObjCreate("Shell.Explorer.2")
    $Active = GUICtrlCreateObj($oIE, $w2,$h2,$l2,$r2)
    $oIE.navigate ($location)
    $oIE.document.body.scroll = "no"
    GUISetState()
    While 1
        Sleep(200)
        $dif = TimerDiff($begin)
        If $dif >= $wait Then 
            GUIDelete($GUI)
            Return 1
        EndIf
    WEnd
    SetError(1)
    Return -1
EndFunc

Func LoadingOff()
    ;NEED HELP HERE
EndFunc

Func CreatePolyRgn($pt) ; Credit goes to Larry for this one (I believe)
    Local $ALTERNATE = 1
    Local $buffer = ""
    $pt = StringSplit($pt,",")
    For $i = 1 to $pt[0]
        $buffer = $buffer & "int;"
    Next
    $buffer = StringTrimRight($buffer,1)
    $lppt = DllStructCreate($buffer)
    For $i = 1 to $pt[0]
        DllStructSetData($lppt,$i,$pt[$i])
    Next
    $ret = DllCall("gdi32.dll","long","CreatePolygonRgn", _
            "ptr",DllStructGetPtr($lppt),"int",Int($pt[0] / 2), _
            "int",$ALTERNATE)
    $lppt = 0
    Return $ret[0]
EndFunc

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

Very nice work

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

Would be even better if it didn't have that white block in the back... particularly on the loading bar. I'm not exactly sure how to do it, but if you look around you could probably figure it out.

That would be very nice, how could I make the white (in the gif) transparent? I'm trying to reason out in my head if it is doable, but I'm not to sure.

Awaiting Diablo III..

Link to comment
Share on other sites

  • 2 weeks later...
  • 9 months later...

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