1 | #include <ScreenCapture.au3> |
---|
2 | |
---|
3 | Global $hScreen, $hBitmap, $aMem, $tData |
---|
4 | |
---|
5 | _GDIPlus_Startup() |
---|
6 | $hScreen=_ScreenCapture_Capture("", 0, 0, -1, -1, False) |
---|
7 | $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hScreen) |
---|
8 | |
---|
9 | For $i=1 To 50 |
---|
10 | $tData = _GDIPlus_BitmapLockBits($hBitmap, 0, 0, _GDIPlus_ImageGetWidth($hBitmap), _GDIPlus_ImageGetHeight($hBitmap), $GDIP_ILMREAD, $GDIP_PXF24RGB) |
---|
11 | _GDIPlus_BitmapUnlockBits($hBitmap, $tData) |
---|
12 | Sleep(50) |
---|
13 | $aMem = MemGetStats() |
---|
14 | ConsoleWrite("original function; step " & $i & "; mem usage: " & $aMem[0] & @LF) |
---|
15 | Next |
---|
16 | |
---|
17 | ConsoleWrite(@LF) |
---|
18 | |
---|
19 | For $i=1 To 50 |
---|
20 | $tData = _GDIPlus_BitmapLockBits($hBitmap, 0, 0, _GDIPlus_ImageGetWidth($hBitmap), _GDIPlus_ImageGetHeight($hBitmap), $GDIP_ILMREAD, $GDIP_PXF24RGB) |
---|
21 | _GDIPlus_BitmapUnlockBits_($hBitmap, $tData) |
---|
22 | Sleep(50) |
---|
23 | $aMem = MemGetStats() |
---|
24 | ConsoleWrite("test function; step " & $i & "; mem usage: " & $aMem[0] & @LF) |
---|
25 | Next |
---|
26 | |
---|
27 | Func _GDIPlus_BitmapUnlockBits_($hBitmap, $tBitmapData) |
---|
28 | Local $aResult |
---|
29 | |
---|
30 | $aResult = DllCall($ghGDIPDll, "int", "GdipBitmapUnlockBits", "hwnd", $hBitmap, "ptr", DllStructGetPtr($tBitmapData)) ;Type ptr instead of int* |
---|
31 | If @error Then Return SetError(@error, @extended, False) |
---|
32 | Return SetError($aResult[0], 0, $aResult[0] = 0) |
---|
33 | EndFunc ;==>_GDIPlus_BitmapUnlockBits |
---|