Skip to content

Instantly share code, notes, and snippets.

@chadaustin
Created October 30, 2015 20:36
Show Gist options
  • Select an option

  • Save chadaustin/4e4424b53174616dc635 to your computer and use it in GitHub Desktop.

Select an option

Save chadaustin/4e4424b53174616dc635 to your computer and use it in GitHub Desktop.
#include <Windows.h>
int main() {
if (!OpenClipboard(NULL)) {
__asm int 3
}
HGLOBAL mem = GlobalAlloc(GMEM_MOVEABLE, 12);
memcpy(GlobalLock(mem), "hello world", 12);
GlobalUnlock(mem);
EmptyClipboard();
SetClipboardData(CF_TEXT, mem);
HANDLE bitmap = CreateBitmap(256, 256, 1, 24, NULL);
SetClipboardData(CF_BITMAP, bitmap);
CloseClipboard();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment