Advertisement
Guest User

Untitled

a guest
Aug 28th, 2015
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. HDC hdc = GetDC(NULL); // get the desktop device context
  2. HDC hDest = CreateCompatibleDC(hdc); // create a device context to use yourself
  3.  
  4. // get the height and width of the screen
  5. int height = GetSystemMetrics(SM_CYVIRTUALSCREEN);
  6. int width = GetSystemMetrics(SM_CXVIRTUALSCREEN);
  7.  
  8. // create a bitmap
  9. HBITMAP hbDesktop = CreateCompatibleBitmap( hdc, width, height);
  10.  
  11. // use the previously created device context with the bitmap
  12. SelectObject(hDest, hbDesktop);
  13.  
  14. // copy from the desktop device context to the bitmap device context
  15. // call this once per 'frame'
  16. BitBlt(hDest, 0,0, width, height, hdc, 0, 0, SRCCOPY);
  17.  
  18. // after the recording is done, release the desktop context you got..
  19. ReleaseDC(NULL, hdc);
  20.  
  21. // ..and delete the context you created
  22. DeleteDC(hDest);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement