// Save existing clipboard content std::wstring existingContent; if (OpenClipboard(nullptr)) { ReadClipboard(existingContent, true); EmptyClipboard(); CloseClipboard(); }
You need to back up and restore data in all formats in the clipboard, not just text data.