Jump to content

GuiDelet is flickering


 Share

Recommended Posts

Test these 2 Scripts

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $Anzahl=60
Global $Ellipse[$Anzahl]

$Form1 = GUICreate("Test", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, BitOR ($WS_EX_TOPMOST, $WS_EX_LAYERED))
GUISetBkColor ( 0x000000 )
GUISetState()

$Ellipse[0]=_DrawTransparentEllipse ( $Form1, @DesktopWidth/2-200, @DesktopHeight/2-200, 250, 200 )

For $i=1 To $Anzahl-1 Step +1
    $Ellipse[$i]=_DrawTransparentEllipse ( $Form1, @DesktopWidth/2-200, @DesktopHeight/2-200, 250+$i, 200 )
    GUIDelete ( $Ellipse[$i-1] )
Next

While 1
    $msg=GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Func _DrawTransparentEllipse($hwnd, $x,$y,$w,$h,$Transparency=255)
    $Child=GUICreate ( "", $w, $h, $x, $y, $WS_CHILD, -1, $hwnd )
    _WinAPI_SetLayeredWindowAttributes($Form1, 0xABCDEF, $Transparency)
    GUISetBkColor ( 0xABCDEF, $Child )
    _GuiRoundCorners ( $Child, 0, 0, $w, $h)
    GUISetState()
    Return $Child
EndFunc

Func _DrawTransparentRect($hwnd, $x,$y,$w,$h,$Transparency=255)
    $Child=GUICreate ( "", $w, $h, $x, $y, $WS_CHILD, -1, $hwnd )
    _WinAPI_SetLayeredWindowAttributes($Form1, 0xABCDEF, $Transparency)
    GUISetBkColor ( 0xABCDEF, $Child )
    GUISetState()
    Return $Child
EndFunc

Func _WinAPI_SetLayeredWindowAttributes($hwnd, $i_transcolor, $Transparency = 255, $dwFlages = 0x03, $isColorRef = False)
  ; progandy
    If $dwFlages = Default Or $dwFlages = "" Or $dwFlages < 0 Then $dwFlages = 0x03
    If Not $isColorRef Then
        $i_transcolor = Hex(String($i_transcolor), 6)
        $i_transcolor = Execute('0x00' & StringMid($i_transcolor, 5, 2) & StringMid($i_transcolor, 3, 2) & StringMid($i_transcolor, 1, 2))
    EndIf
    Local $Ret = DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", $hwnd, "long", $i_transcolor, "byte", $Transparency, "long", $dwFlages)
    Select
        Case @error
            Return SetError(@error, 0, 0)
        Case $Ret[0] = 0
            Return SetError(4, _WinAPI_GetLastError(), 0)
        Case Else
            Return 1
    EndSelect
EndFunc ;==>_WinAPI_SetLayeredWindowAttributes

Func _WinAPI_GetLastError()
    Local $aResult

    $aResult = DllCall("Kernel32.dll", "int", "GetLastError")
    If @error Then Return SetError(@error, 0, 0)
    Return $aResult[0]
EndFunc   ;==>_WinAPI_GetLastError

Func _GuiRoundCorners($hWnd, $x1, $y1, $x3, $y3)
    Local $pos, $ret, $ret2
    $pos = WinGetPos($hWnd)
    $ret = DllCall('gdi32.dll', 'long', 'CreateRoundRectRgn', 'long', $x1, 'long', $y1, 'long', $pos[2], 'long', $pos[3], 'long', $x3, 'long', $y3)
    If $ret[0] Then
        $ret2 = DllCall('user32.dll', 'long', 'SetWindowRgn', 'hwnd', $hWnd, 'long', $ret[0], 'int', 1)
        If $ret2[0] Then
            Return 1
        Else
            Return 0
        EndIf
    Else
        Return 0
    EndIf
EndFuncoÝ÷ Ûû)jr-ßÛ'$z¸§»­.±ëazÇ¢wRr¸©µ©ÝrZ,z+pØDH+az{axe²­ué^µç[È­ 즥z¶®¶­sb6æ6ÇVFRfÇC´uT6öç7FçG4WæS2fwC°¢6æ6ÇVFRfÇCµvæF÷w46öç7FçG2æS2fwC° ¤vÆö&Âb33c´ç¦ÃÓc¤vÆö&Âb33c´VÆÆ6U²b33c´ç¦ÅÐ ¢b33c´f÷&ÓÒuT7&VFRgV÷CµFW7BgV÷C²ÂFW6·F÷vGFÂFW6·F÷VvBÂÂÂb33cµu5õõUÂ&Dõ"b33cµu5ôUõDõÔõ5BÂb33cµu5ôUôÄU$TB¤uT6WD&´6öÆ÷"¤uT6WE7FFR ¢b33c´VÆÆ6U³ÓÕôG&uG&ç7&VçDVÆÆ6Rb33c´f÷&ÓÂFW6·F÷vGFó"Ó#ÂFW6·F÷VvBó"Ó#Â#SÂ# ¤f÷"b33c¶ÓFòb33c´ç¦ÂÓ7FW³ b33c´VÆÆ6U²b33c¶ÓÕôG&uG&ç7&VçDVÆÆ6Rb33c´f÷&ÓÂFW6·F÷vGFó"Ó#ÂFW6·F÷VvBó"Ó#Â#S²b33c¶Â#£·âuTFVÆWFRb33c´VÆÆ6U²b33c¶ÓÒ¤æW@ ¥vÆR b33c¶×6sÔuTvWD×6r 7vF6b33c¶×6p 66Rb33c´uTôUdTåEô4Äõ4P W@ VæE7vF6¥tVæ@ ¤gVæ2ôG&uG&ç7&VçDVÆÆ6Rb33c¶væBÂb33c·Âb33c·Âb33c·rÂb33c¶Âb33cµG&ç7&Væ7Ó#SR b33c´6ÆCÔuT7&VFRgV÷C²gV÷C²Âb33c·rÂb33c¶Âb33c·Âb33c·Âb33cµu5ô4ÄBÂÓÂb33c¶væB õväõ6WDÆW&VEvæF÷tGG&'WFW2b33c´f÷&ÓÂ$4DTbÂb33cµG&ç7&7¢uT6WD&´6öÆ÷"$4DTbÂb33c´6ÆB ôwV&÷VæD6÷&æW'2b33c´6ÆBÂÂÂb33c·rÂb33c¶¢uT6WE7FFR &WGW&âb33c´6Æ@¤VæDgVæ0 ¤gVæ2ôG&uG&ç7&VçE&V7Bb33c¶væBÂb33c·Âb33c·Âb33c·rÂb33c¶Âb33cµG&ç7&Væ7Ó#SR b33c´6ÆCÔuT7&VFRgV÷C²gV÷C²Âb33c·rÂb33c¶Âb33c·Âb33c·Âb33cµu5ô4ÄBÂÓÂb33c¶væB õväõ6WDÆW&VEvæF÷tGG&'WFW2b33c´f÷&ÓÂ$4DTbÂb33cµG&ç7&Væ7¢uT6WD&´6öÆ÷"$4DTbÂb33c´6ÆB¢uT6WE7FFR &WGW&âb33c´6Æ@¤VæDgVæ0 ¤gVæ2õväõ6WDÆW&VEvæF÷tGG&'WFW2b33c¶væBÂb33c¶÷G&ç66öÆ÷"Âb33cµG&ç7&Væ7Ò#SRÂb33c¶GtfÆvW2Ò2Âb33c¶46öÆ÷%&VbÒfÇ6R¢²&övæG¢bb33c¶GtfÆvW2ÒFVfVÇB÷"b33c¶GtfÆvW2ÒgV÷C²gV÷C²÷"b33c¶GtfÆvW2fÇC²FVâb33c¶GtfÆvW2Ò0¢bæ÷Bb33c¶46öÆ÷%&VbFVà¢b33c¶÷G&ç66öÆ÷"ÒW7G&ærb33c¶÷G&ç66öÆ÷"Âb¢b33c¶÷G&ç66öÆ÷"ÒWV7WFRb33³b33²fײ7G&ætÖBb33c¶÷G&ç66öÆ÷"ÂRÂ"fײ7G&ætÖBb33c¶÷G&ç66öÆ÷"Â2Â"fײ7G&ætÖBb33c¶÷G&ç66öÆ÷"ÂÂ"¢VæD`¢Æö6Âb33cµ&WBÒFÆÄ6ÆÂgV÷C·W6W#3"æFÆÂgV÷C²ÂgV÷C¶çBgV÷C²ÂgV÷Cµ6WDÆW&VEvæF÷tGG&'WFW2gV÷C²ÂgV÷C¶væBgV÷C²Âb33c¶væBÂgV÷C¶ÆöærgV÷C²Âb33c¶÷G&ç66öÆ÷"ÂgV÷C¶'FRgV÷C²Âb33cµG&ç7&Væ7ÂgV÷C¶ÆöærgV÷C²Âb33c¶GtfÆvW2¢6VÆV7@¢66RW'&÷ ¢&WGW&â6WDW'&÷"W'&÷"¢66Rb33cµ&WE³ÒÒ¢&WGW&â6WDW'&÷"BÂõväôvWDÆ7DW'&÷"¢66RVÇ6P¢&WGW&â¢VæE6VÆV7@¤VæDgVæ2³ÓÒfwCµõväõ6WDÆW&VEvæF÷tGG&'WFW0 ¤gVæ2õväôvWDÆ7DW'&÷" Æö6Âb33c¶&W7VÇ@  b33c¶&W7VÇBÒFÆÄ6ÆÂgV÷C´¶W&æVÃ3"æFÆÂgV÷C²ÂgV÷C¶çBgV÷C²ÂgV÷C´vWDÆ7DW'&÷"gV÷C² bW'&÷"FVâ&WGW&â6WDW'&÷"W'&÷" &WGW&âb33c¶&W7VÇE³Ð¤VæDgVæ2³ÓÒfwCµõväôvWDÆ7DW'&÷  ¤gVæ2ôwV&÷VæD6÷&æW'2b33c¶væBÂb33c·Âb33c·Âb33c·2Âb33c·2¢Æö6Âb33c·÷2Âb33c·&WBÂb33c·&WC ¢b33c·÷2ÒvävWE÷2b33c¶væB¢b33c·&WBÒFÆÄ6ÆÂb33¶vF3"æFÆÂb33²Âb33¶Æöærb33²Âb33´7&VFU&÷VæE&V7E&vâb33²Âb33¶Æöærb33²Âb33c·Âb33¶Æöærb33²Âb33c·Âb33¶Æöærb33²Âb33c·÷5³%ÒÂb33¶Æöærb33²Âb33c·÷5³5ÒÂb33¶Æöærb33²Âb33c·2Âb33¶Æöærb33²Âb33c·2¢bb33c·&WE³ÒFVà¢b33c·&WC"ÒFÆÄ6ÆÂb33·W6W#3"æFÆÂb33²Âb33¶Æöærb33²Âb33µ6WEvæF÷u&vâb33²Âb33¶væBb33²Âb33c¶væBÂb33¶Æöærb33²Âb33c·&WE³ÒÂb33¶çBb33²Â¢bb33c·&WC%³ÒFVà¢&WGW&â¢VÇ6P¢&WGW&â¢VæD`¢VÇ6P¢&WGW&â¢VæD`¤VæDgVæ

It's not flickering.

Someone know, how AutoIt delet the GUIs without that flickering?

Link to comment
Share on other sites

Someone know, how AutoIt delet the GUIs without that flickering?

Add the style WS_EX_COMPOSITED to the main gui like this

Global Const $WS_EX_COMPOSITED = 0x2000000 
   $Form1 = GUICreate("Test", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, BitOR ($WS_EX_TOPMOST, $WS_EX_LAYERED,$WS_EX_COMPOSITED))
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Add the style WS_EX_COMPOSITED to the main gui like this

Global Const $WS_EX_COMPOSITED = 0x2000000 
   $Form1 = GUICreate("Test", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, BitOR ($WS_EX_TOPMOST, $WS_EX_LAYERED,$WS_EX_COMPOSITED))
Wow Thanks O.o

Now the UDFs are perfekt ^_^

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