I'm trying to make little c program that copies text to clipboard. I found this question asked on this website. Programs code:
const char* output = "Test";
const size_t len = strlen(output) + 1;
HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, len);
memcpy(GlobalLock(hMem), output, len);
GlobalUnlock(hMem);
OpenClipboard(0);
EmptyClipboard();
SetClipboardData(CF_TEXT, hMem);
CloseClipboard();
This program does copy text to clipboard. But i need it to copy 2 lines. So i try this:
const char* output = "Test1\nTest2";
But it gets copied as literal. How can i fix this code so result would be:
Test1
Test2
rather then:
Test1\nTest2
Aucun commentaire:
Enregistrer un commentaire