Introduction
This piece of code is to help you backup your clipboard data and restore it after you have finished other clipboard operations.
My experience: while I'm developing Word add-in programs, the icon of the new-added button can only be set through clipboard by "...->PasteFace()
". This will empty the clipboard data which is going to be pasted in Word. So, I wrote this class, and it helped me a lot.
Usage:
CClipboardBackup cbbackup;
::OpenClipboard(NULL);
::EmptyClipboard();
::SetClipboardData(......);
::CloseClipboard();
....
cbbackup.Restore();
Advertisement
By the way, my another article about another topic on another website :) :