Jump to content

_WinAPI_InvalidateRect


Recommended Posts

Hi,

#include <GUIConstantsEx.au3>
#Include <GDIPlus.au3>
#Include <WinAPI.au3>

Global Const $ApD = 360, $rD = 40
Global $rX = 0, $rY = 0 

$hGui = GUICreate(":-)", $ApD, $ApD)
GUISetState(@SW_SHOW, $hGui)

_GDIPlus_Startup()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGui)
_GDIPlus_GraphicsClear($hGraphic, 0xFF0000FF)

AdlibEnable("_Invalidate", 200)

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            _GDIPlus_GraphicsDispose($hGraphic)
            _GDIPlus_Shutdown()
            Exit
        Case Else
    EndSwitch
WEnd

Func _Invalidate()
    Local $tRect = DllStructCreate($tagRECT)
    DllStructSetData($tRect, "Left", $rX)
    DllStructSetData($tRect, "Top", $rY)
    DllStructSetData($tRect, "Right", $rX + $rD)
    DllStructSetData($tRect, "Bottom", $rY + $rD)
    
    _WinAPI_InvalidateRect($hGui, $tRect, True)
    
    $rX += $rD*2
    If $rX >= $ApD And $rY < $ApD Then 
        $rX = 0
        $rY += $rD*2
    ElseIf $rX >= $ApD And $rY >= $ApD Then
        _GDIPlus_GraphicsClear($hGraphic, 0xFF0000FF)
        $rX = 0
        $rY = 0
    EndIf   
EndFunc

Cheers

Link to comment
Share on other sites

  • Moderators

Can somebody to write a simple example that include this function?

Thanks!

http://www.autoitscript.com/forum/index.ph..._InvalidateRect

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.

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