Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2019
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 1.01 KB | None | 0 0
  1. #include <WinAPI.au3>
  2. #include <Gdiplus.au3>
  3. #include <WindowsConstants.au3>
  4.  
  5. ;~ Const $DIB_RGB_COLORS = 0
  6. $iWidth = @DesktopWidth / 2
  7. $iHeight = @DesktopHeight / 2
  8.  
  9.  
  10. $hDC = _WinAPI_GetDC(0)
  11.  
  12. $gui = GUICreate("", $iWidth, $iHeight)
  13. GUISetState()
  14.  
  15. _GDIPlus_Startup()
  16. $graphic = _GDIPlus_GraphicsCreateFromHWND($gui)
  17.  
  18. ;~ _GDIPlus_GraphicsDrawImage($graphic, $hBMP, 0, 0)
  19.  
  20. While 1
  21.  
  22.     $time = TimerInit()
  23.     $bitmap = ScreenToBitmap($hDC)
  24.     $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($bitmap)
  25.  
  26.     _GDIPlus_GraphicsDrawImage($graphic, $hBitmap, 0, 0)
  27.  
  28.     $timediff =  TimerDiff($time)
  29.     ConsoleWrite("FPS: " & Round(1000 / $timediff) & "  took: " & $timediff & @CRLF)
  30.     If GUIGetMsg() = - 3 Then Exit
  31. WEnd
  32.  
  33.  
  34. Func ScreenToBitmap($hDC)
  35.  
  36.     Local $tDC = _WinAPI_CreateCompatibleDC($hDC)
  37.     Local $hBMP = _WinAPI_CreateCompatibleBitmap($hDC, $iWidth, $iHeight)
  38.     _WinAPI_SelectObject($tDC, $hBMP)
  39.     _WinAPI_BitBlt($tDC, 0, 0, $iWidth, $iHeight, $hDC, 0, 0, $SRCCOPY)
  40.  
  41.     _WinAPI_DeleteDC($tDC)
  42.     Return $hBMP
  43. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement