Sign in to follow this  
Followers 0
Andreik

_WinAPI_InvalidateRect

4 posts in this topic

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

Thanks!


When the words fail... music speaks

Share this post


Link to post
Share on other sites



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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Thanks smashly, SmOke_N! Now I know how I can use it.


When the words fail... music speaks

Share this post


Link to post
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
Sign in to follow this  
Followers 0