Jump to content

GUICtrlSetPos causes flicker


 Share

Recommended Posts

#include <GUIConstants.au3>

HotKeySet("{F4}","Terminate")

Global $LastAction = 0
Global $Wait = 0

Global $FaceExp[b][/b]ressions[10]

$FaceExp[b][/b]ressions[0] = "Face_Smile.jpg"
$FaceExp[b][/b]ressions[1] = "Face_Smile_Blink_L.jpg"
$FaceExp[b][/b]ressions[2] = "Face_Smile_Blink_R.jpg"

WinSetState(WinGetHandle("classname=Shell_TrayWnd"), "", @SW_HIDE)

DllCall("user32.dll", "int", "ShowCursor", "int", 0);HIDE CURSOR

GUICreate("",@DesktopWidth,@DesktopHeight,0,0,$WS_POPUP + $WS_SYSMENU + $WS_MINIMIZEBOX)

GUISetBkColor(0x000000)

GUICtrlCreateLabel("",0,0,@DesktopWidth,@DesktopHeight)
GUICtrlSetColor(-1,0x000000)

$Face = GUICtrlCreatePic($FaceExp[b][/b]ressions[0],@DesktopWidth/2-200/2,@DesktopHeight-200/2,200,200)

GUISetState()

Say("Hello")

$Timer = TimerInit()

While 1
    If $Wait = 0 Then
        $LastAction = $LastAction + Round(Random(2,5))
        $Wait = 1
    EndIf
    
    If Round(TimerDiff($Timer)) >= $LastAction Then
        GUICtrlSetImage($Face,$FaceExp[b][/b]ressions[Round(Random(1,2))])
        Sleep(100)
        GUICtrlSetImage($Face,$FaceExp[b][/b]ressions[0])
        $LastAction = Round(TimerDiff($Timer)) + Round(Random(2,5))
        $Wait = 0
    EndIf
WEnd

GUIDelete()

WinSetState(WinGetHandle("classname=Shell_TrayWnd"), "", @SW_SHOW)

Func Terminate()
    Exit
EndFunc

Func Say($sText)
    $tempFile = @TempDir & '\talktemp.vbs'   ; Set the temp file
    FileWriteLine($tempFile, 'Dim Talk' & @CRLF & _
    'Set Talk = WScript.CreateObject("SAPI.SpVoice")' & _
    @CRLF & 'Talk.Speak "' & $sText & '"'); Add contents to the temp file
    RunWait('Wscript.exe talktemp.vbs', @TempDir); Run the VBScript
    FileDelete($tempFile)
EndFunc

Edited by jpm
Ha, I haven't been on these forums since... 2006, almost. Behold, my legacy signature:My AutoIt idol is Valuater. You know you love him, too.My Stuff: D&D AGoT Tools Suite
Link to comment
Share on other sites

1

please use code blocks to post code

[ code] ; no space

; paste code

[ /code] ; no space

2

I notice a label that is not being used

try removing this

GUICtrlCreateLabel("",0,0,@DesktopWidth,@DesktopHeight)
GUICtrlSetColor(-1,0x000000)

3

you are using

Round(Random(1,2)

just use

Random(1,2,1)

8)

Edited by Valuater

NEWHeader1.png

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