Skip to content

Instantly share code, notes, and snippets.

@tuttlem
Created November 28, 2012 13:36
Show Gist options
  • Save tuttlem/4161329 to your computer and use it in GitHub Desktop.
Save tuttlem/4161329 to your computer and use it in GitHub Desktop.
DestroyBackBuffer
DestroyBackBuffer PROC hWin:DWORD
; determine if we need to destroy the memory DC
cmp memDC, NULL
je MemoryDCDeallocated
; we do, so kill off these GDI objects
invoke SelectObject, memDC, memOldBitmap
invoke DeleteObject, memBitmap
invoke DeleteDC, memDC
; null them out so there's no confusion
mov memDC, NULL
mov memOldBitmap, NULL
mov memBitmap, NULL
MemoryDCDeallocated:
; determine if we need to release the window dc
cmp winDC, NULL
je WindowDCReleased
; we do - release and null
invoke ReleaseDC, hWin, winDC
mov winDC, NULL
WindowDCReleased:
xor eax, eax
ret
DestroyBackBuffer ENDP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment