Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <WinAPI.au3>
- #include <Gdiplus.au3>
- #include <WindowsConstants.au3>
- ;~ Const $DIB_RGB_COLORS = 0
- $iWidth = @DesktopWidth / 2
- $iHeight = @DesktopHeight / 2
- $hDC = _WinAPI_GetDC(0)
- $gui = GUICreate("", $iWidth, $iHeight)
- GUISetState()
- _GDIPlus_Startup()
- $graphic = _GDIPlus_GraphicsCreateFromHWND($gui)
- ;~ _GDIPlus_GraphicsDrawImage($graphic, $hBMP, 0, 0)
- While 1
- $time = TimerInit()
- $bitmap = ScreenToBitmap($hDC)
- $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($bitmap)
- _GDIPlus_GraphicsDrawImage($graphic, $hBitmap, 0, 0)
- $timediff = TimerDiff($time)
- ConsoleWrite("FPS: " & Round(1000 / $timediff) & " took: " & $timediff & @CRLF)
- If GUIGetMsg() = - 3 Then Exit
- WEnd
- Func ScreenToBitmap($hDC)
- Local $tDC = _WinAPI_CreateCompatibleDC($hDC)
- Local $hBMP = _WinAPI_CreateCompatibleBitmap($hDC, $iWidth, $iHeight)
- _WinAPI_SelectObject($tDC, $hBMP)
- _WinAPI_BitBlt($tDC, 0, 0, $iWidth, $iHeight, $hDC, 0, 0, $SRCCOPY)
- _WinAPI_DeleteDC($tDC)
- Return $hBMP
- EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement