I have a program where the user can copy text to the clipboard by clicking a drop down menu item.
My question is, does a call to EmptyClipboard free the data previously allocated with the call to GlobalAlloc? Or do i need to free the data with GlobalFree? I dont want to create memory leaks.
this is my code
My question is, does a call to EmptyClipboard free the data previously allocated with the call to GlobalAlloc? Or do i need to free the data with GlobalFree? I dont want to create memory leaks.
this is my code
Code Select
...
BYTE size = strPath.size() + 1;
char *pText = (char *)GlobalAlloc(GMEM_FIXED, size);
strcpy(pText, strPath.c_str());
OpenClipboard(hWnd);
EmptyClipboard();
SetClipboardData(CF_TEXT, pText);
CloseClipboard();
...