Jump to content

Recommended Posts

Posted

almost flicker free labels with pic

best regards

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <WinAPI.au3>
_Example1()
_Example2()
Func _Example1()
$gui = GUICreate("Example1 flicker", 500, 300, -1, -1, -1, -1)
GUICtrlCreatePic(@ScriptDir & "\test.jpg", 0, 0, 500, 300, -1, $WS_EX_TOPMOST)
GUICtrlSetState(-1, $GUI_DISABLE)
$Label = GUICtrlCreateLabel("123", 10, 150, 480, 30, $SS_CENTER)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 22, 800)
GUISetState(@SW_SHOW, $gui)
For $i = 1 To 1000
  Sleep(10)
  GUICtrlSetData($Label, $i * $i)
Next
Sleep(1000)
GUIDelete($gui)
EndFunc   ;==>_Example1
Func _Example2()
$gui = _GuiCreateEx("Example2 flicker free", 500, 300, -1, -1, -1, -1, -1, @ScriptDir & "\test.jpg")
$Label = GUICtrlCreateLabel("123", 10, 150, 480, 30, $SS_CENTER)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 22, 800)
GUISetState(@SW_SHOW, $gui)
For $i = 1 To 1000
  Sleep(10)
  GUICtrlSetData($Label, $i * $i)
Next
Sleep(1000)
GUIDelete($gui)
EndFunc   ;==>_Example2

Func _GuiCreateEx($sText, $iWith, $iHeight, $iLeft = -1, $iTop = -1, $sStyle = -1, $sExStyle = -1, $hParent = -1, $pPic = -1)
$__h_GUI = GUICreate($sText, $iWith, $iHeight, $iLeft, $iTop, $sStyle, $sExStyle)
If $pPic <> -1 Then
  GUICtrlCreatePic($pPic, $iLeft, $iTop, $iWith, $iHeight, -1, $WS_EX_TOPMOST)
  GUICtrlSetState(-1, $GUI_DISABLE)
  GUISetState()
  $__guiTrans = GUICreate("", $iWith, $iHeight, $iLeft, $iTop, $WS_POPUP, $WS_EX_LAYERED, $__h_GUI)
  DllCall("user32.dll", "hwnd", "SetParent", "hwnd", WinGetHandle($__h_GUI), "hwnd", WinGetHandle($__guiTrans))
  GUISetBkColor(0x100001)
  _WinAPI_SetLayeredWindowAttributes($__guiTrans, 0x100001, 255)
EndIf
If $pPic <> -1 Then
  Return WinGetHandle($__guiTrans)
Else
  Return WinGetHandle($__h_GUI)
EndIf
EndFunc   ;==>_GuiCreateEx

GuiEx.rar

Posted

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
AutoItSetOption("GUIOnEventMode", 1)
GUICreate("Example1 flicker", 500, 300, -1, -1, -1, $WS_EX_COMPOSITED)
GUISetOnEvent(-3, "Terminate")
$label = GUICtrlCreateLabel("123", 10, 150, 480, 30, $SS_CENTER)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 22, 800)
GUISetState()
GUICtrlCreatePic(@ScriptDir & "test.jpg", 0, 0, 500, 300, -1, $WS_EX_TOPMOST)
For $i = 1 To 1000
Sleep(10)
GUICtrlSetData($Label, $i * $i)
Next
Func Terminate()
    Exit
EndFunc   ;==>_Exit

Posted (edited)

?

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
AutoItSetOption("GUIOnEventMode", 1)
GUICreate("Example1 flicker", 500, 300, -1, -1, -1, $WS_EX_COMPOSITED)
GUISetOnEvent(-3, "Terminate")
$label = GUICtrlCreateLabel("123", 10, 150, 480, 30, $SS_CENTER)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 22, 800)
GUISetState()
GUICtrlCreatePic(@ScriptDir & "test.jpg", 0, 0, 500, 300, -1, $WS_EX_TOPMOST)
For $i = 1 To 1000
Sleep(10)
GUICtrlSetData($Label, $i * $i)
Next
Func Terminate()
    Exit
EndFunc   ;==>_Exit

This flicker for me (Windows 7 64bit)

Edited by bladem2003
Posted

This flicker for me (Windows 7 64bit)

Good reminder (by you for you) that what works for you might not works for someone else.

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Posted

Interesting...

I just tested these on Vista x64 and his second example works flawlessly, where mine was flickering left and right.

But on Windows XP x86, it's the other way around....

Posted (edited)

this works on window 7 64bit and maybe vista

the problem is AERO style

Toggle_AERO_Style_On()
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
AutoItSetOption("GUIOnEventMode", 1)
GUICreate("Example1 flicker", 500, 300, -1, -1, -1, $WS_EX_COMPOSITED)
GUISetOnEvent(-3, "Terminate")
$label = GUICtrlCreateLabel("123", 10, 150, 480, 30, $SS_CENTER)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 22, 800)
GUISetState()
GUICtrlCreatePic(@ScriptDir & "test.jpg", 0, 0, 500, 300, -1, $WS_EX_TOPMOST)
For $i = 1 To 1000
Sleep(10)
GUICtrlSetData($Label, $i * $i)
Next
Func Terminate()
    Exit
EndFunc   ;==>_Exit

Func Toggle_AERO_Style_On($toggle = True)
; Disable AERO effect on Vista and Win7 => MPlayer requires this
; http://msdn.microsoft.com/en-us/library ... 85%29.aspx
Local Const $DWM_EC_DISABLECOMPOSITION = 0
Local Const $DWM_EC_ENABLECOMPOSITION = 1
If $toggle = True Then
  DllCall("dwmapi.dll", "hwnd", "DwmEnableComposition", "uint", $DWM_EC_DISABLECOMPOSITION)
Else
  DllCall("dwmapi.dll", "hwnd", "DwmEnableComposition", "uint", $DWM_EC_ENABLECOMPOSITION)
EndIf
EndFunc   ;==>Toggle_AERO_Style_On
Edited by bladem2003

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