copy-demo-bitmap
: copy-demo-bitmap { flag \ hbm hdcMem -- }
GetHandle: DEMOW call OpenClipboard 0=
IF s" Can't Open Clipboard\n\n...press a key to continue"
"demo-message
key drop demo-message-off
EXIT
THEN flag
SCREEN-HEIGHT
SCREEN-WIDTH
GetHandle: demo-dc
call CreateCompatibleBitmap to hbm
GetHandle: demo-dc
call CreateCompatibleDC to hdcMem
hbm hdcMem call SelectObject drop
r>
IF NOTSRCCOPY
ELSE SRCCOPY
THEN
0 0 \ y,x origin
GetHandle: demo-dc \ from the screen
SCREEN-HEIGHT \ source height
SCREEN-WIDTH \ source width
0 0 hdcMem \ to new bitmap
call BitBlt ?win-error \ invert the bitmap
call EmptyClipboard ?win-error \ clear out the clipboard
hbm CF_BITMAP call SetClipboardData ?win-error
call CloseClipboard ?win-error
hdcMem call DeleteDC ?win-error
\ We don't delete the bitmap because it is now owned by the clipboard !!
\ hbm call DeleteObject ?win-error
;