Jump to content
Sign in to follow this  
Andreik

_WinAPI_InvalidateRect

Recommended Posts

Andreik

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
smashly

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
Andreik

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.