#include gdip.ahk
Gui, +hwndhgui
Gui, Show, w200 h200, Test
pToken := Gdip_Startup()
dc := GetDC(hgui)
pGraphics := Gdip_GraphicsFromHDC(dc)
pBrush := Gdip_BrushCreateSolid(0xff800080) ;purple
Gdip_FillRectangle(pGraphics, pBrush, 0, 0, 200, 200)
OnMessage(0xF, "WM_PAINT") ;Set the function to run when 0xF is received
OnExit, GuiClose
return
GuiClose:
;Free resources
ReleaseDC(dc)
Gdip_DeleteBrush(pBrush)
Gdip_DeleteGraphics(pGraphics)
Gdip_Shutdown(pToken)
ExitApp
return
;This function will run when AHK gets a WM_PAINT message
WM_PAINT(wparam, lparam)
{
global pGraphics, pBrush ;They say globals are bad but for simplicity...
TrayTip, Gdip example, WM_PAINT received
Gdip_FillRectangle(pGraphics, pBrush, 0, 0, 200, 200) ;fill in the rectangle again
}
On my computer I don't get WM_PAINT for a window overlapping my gui, but it doesn't erase the image either..
Hope it helps anyway.