Jump to content

Recommended Posts

Posted (edited)

Hello there,

I tried to reproduce the animated bar of the "classic style logon screen" Windows XP uses. It works, although I have excessive flickering. Any ideas?

#include <GuiConstants.au3>

GUICreate("Animated bar",680,300,-1,-1)

$bar=GUICtrlCreatePic("./barbg.gif",0,0,680,15)
$bar2=GUICtrlCreatePic("./barbg.gif",-680,0,680,15)

GUISetState ()

$count = 0

While 1
While $count <= 680
    $count = $count + 10
    GUICtrlSetPos ($bar, $count,0)
    GUICtrlSetPos ($bar2, -680+$count,0)
    $msg = GUIGetMsg()
        If $msg = $GUI_EVENT_CLOSE Then Exit
    sleep(50)
Wend
$count = 0
Wend

You can find barbg.gif in the attachment.

Thanks in advance!

Edited by FrashMX
Posted

You might try something like getting the handles of the controls (GUICtrlGetHandle in the latest betas) and then use that handle in WinMove().

Posted (edited)

You might try something like getting the handles of the controls (GUICtrlGetHandle in the latest betas) and then use that handle in WinMove().

I would think ControlMove would work better instead of moving the whole window

Made a solid bar so only have to move one graphic, and set the sleep a little higher

#include <GuiConstants.au3>

$gui = GUICreate("Animated bar", 680, 300, -1, -1)

$bar = GUICtrlCreatePic("barbg-1.gif", 0, 0, 680, 15)
$bar2 = GUICtrlCreatePic("barbg.gif", -680, 0, 680, 15)

GUISetState()

$count = 0

While 1
    While $count <= 680 * 2
        $msg = GUIGetMsg()
        If $msg = $GUI_EVENT_CLOSE Then Exit
        $count = $count + 10
  ;GUICtrlSetPos ($bar, $count,0)
        ControlMove($gui, "", $bar2, -680 + $count, 0)
  ;GUICtrlSetPos ($bar2, -680+$count,0)
        Sleep(100)
    WEnd
    $count = 0
WEnd

http://www.autoitscript.com/fileman/users/gafrost/barbg-1.JPG

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Posted

Gary, re-read. I didn't say move the whole window, I said get a handle to the control and use WinMove() on the control. It will move the control, not the whole window.

Posted

Gary, re-read. I didn't say move the whole window, I said get a handle to the control and use WinMove() on the control. It will move the control, not the whole window.

My bad, little hard to concentrate this morning inner ear problem causing equal Librium offset

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Posted (edited)

Thanks for them replies, ima check it out.

My bad, little hard to concentrate this morning inner ear problem causing equal Librium offset

That somehow sounds really annoying.. hope it'll go over soon (w/e it is)

Edit 1: Btw I tried both scripts and I still experience (minor) flickering. I might be too perfectionistic in this case heh

Edit 2: I noticed the flickering only occurs at certain spots.. it's not like the entire image is flickering

Edited by FrashMX
  • Moderators
Posted

Nice Larry... Very Nice (as usual)

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Posted (edited)

Holy cow, this is simply amazing. Very awesome Larry!

For those who are interested, I added a few bars:

bar_blue - A bar with blue gradient (Windows XP alike)

bar_gray - A bar with a gray gradient (Windows Server alike)

bar_gold - A bar with a golden gradient

bar_maroon - A bar with a maroon gradient

bar_blue.bmp

bar_gold.bmp

bar_maroon.bmp

bar_gray.bmp

Edited by FrashMX
  • 1 year later...
Posted (edited)

I realize this is over a year old, but I like this idea. But how do you use it with a program that sleeps and polls every second?

Where do you learn about all these dll calls.. this is so complicated to me now..

$hInst = DllCall("user32.dll", "int", "GetWindowLong", "hWnd", $hwnd, "int", $GWL_HINSTANCE)
    $hBmp = DllCall("user32.dll", "hwnd", "LoadImage", "hwnd", $hInst[0], "str", $szFile, _
            "int", $IMAGE_BITMAP, "int", 0, "int", 0, "int", $LR_LOADFROMFILE)
    $phWnd = DLLCall("user32.dll","hwnd","GetDlgItem","hwnd",$hWin,"int",$nID)
    $dc = DllCall("user32.dll","int","GetDC","hwnd",$phWnd[0])
    $dc1 = DLLCall("gdi32.dll","int","CreateCompatibleDC","int",$dc[0])
    $old = DLLCall("gdi32.dll","hwnd","SelectObject","int",$dc1[0],"hwnd",$hBmp[0])
?????

Also.. I want a thin thing like this to continue orbiting a rectangle.. that would be cool effect

Edited by rush4hire

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
  • Recently Browsing   0 members

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