Thanks to everyone who replied in this thread
I was able to realize my long-awaited solution
Simplified snippet:
#include <GUIConstantsEx.au3>
#include <ScreenCapture.au3>
Global $g_hGUI = GUICreate("GDI+ test 2", 600, 600, -1, -1)
GUISetState(@SW_SHOW, $g_hGUI)
_GDIPlus_Startup()
Global $g_hGraphics = _GDIPlus_GraphicsCreateFromHWND($g_hGUI)
OnAutoItExitRegister("CleanupResources")
Local $tDelta = TimerInit()
Do
If TimerDiff($tDelta) >= 67 Then ; => 30 FPS
$tDelta = TimerInit()
RefreshImage()
EndIf
Until GUIGetMsg() == $GUI_EVENT_CLOSE
Func RefreshImage()
Local $hHBmp = _ScreenCapture_Capture("", 0, 0, 500, 500)
Local $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hHBmp)
_GDIPlus_GraphicsDrawImage($g_hGraphics, $hBitmap, 50, 50)
_WinAPI_DeleteObject($hHBmp)
_GDIPlus_BitmapDispose($hBitmap)
EndFunc
Func CleanupResources()
_GDIPlus_GraphicsDispose($g_hGraphics)
_GDIPlus_Shutdown()
GUIDelete($g_hGUI)
EndFunc