_Kurt Posted December 12, 2006 Posted December 12, 2006 (edited) 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 Edited December 16, 2006 by _Kurt Awaiting Diablo III..
dandymcgee Posted December 12, 2006 Posted December 12, 2006 Hey, that's pretty cool! 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. - Dan [Website]
Valuater Posted December 12, 2006 Posted December 12, 2006 (edited) Not bad!!! added timer expandcollapse popup#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 December 12, 2006 by Valuater
_Kurt Posted December 13, 2006 Author Posted December 13, 2006 (edited) Very nice Valuater. Should have thought of that myself Kurt Edited December 14, 2006 by _Kurt Awaiting Diablo III..
Valuater Posted December 13, 2006 Posted December 13, 2006 Welcome.. Listen, if you are going to use the Loading.au3 as an include... you should place these two lines at the top of the file #include <GUIConstants.au3> #include-once both of them 8)
ConsultingJoe Posted December 13, 2006 Posted December 13, 2006 Very nice work Check out ConsultingJoe.com
_Kurt Posted December 13, 2006 Author Posted December 13, 2006 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..
_Kurt Posted December 16, 2006 Author Posted December 16, 2006 No thoughts on how to improve the UDF? or any comments either? Awaiting Diablo III..
nooby Posted December 28, 2006 Posted December 28, 2006 How does this work? im new to autoit and i dont understand this. help mee
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now