Click here to Skip to main content
11,494,964 members (66,754 online)
Click here to Skip to main content

Clipboard backup (Visual C++)

, 20 Sep 2005 CPOL 121.9K 1.1K 49
Rate this:
Please Sign up or sign in to vote.
Make a backup copy of clipboard data before your clipboard operation, and when you finish, you can restore clipboard to its original status.

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:

  // the constructor will do backup clipboard operation
  CClipboardBackup cbbackup;
 
  // any other clipboard operations
  ::OpenClipboard(NULL);
  ::EmptyClipboard();
  ::SetClipboardData(......);
  ::CloseClipboard();
  ....
 
  // restore
  cbbackup.Restore();

Advertisement

By the way, my another article about another topic on another website Smile | :) :

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

sswater shi
Software Developer (Senior)
China China
Begin coding from basic, since 1994. Interested in coding and database and website constructing.
My website: http://www.regexlab.com/ - Regular Expression Laboratory
The easiest regex engine: http://www.regexlab.com/deelx/

Comments and Discussions

 
GeneralMy vote of 1 Pin
AdminSam18-Jan-12 20:20
memberAdminSam18-Jan-12 20:20 
GeneralProblem with CF_BITMAP Pin
MohammadAmiry28-Mar-07 14:06
memberMohammadAmiry28-Mar-07 14:06 
GeneralRe: Problem with CF_BITMAP Pin
sswater shi28-Mar-07 15:36
membersswater shi28-Mar-07 15:36 
Questionproblem with outlook Pin
vice12-Feb-07 7:53
membervice12-Feb-07 7:53 
AnswerRe: problem with outlook Pin
sswater shi13-Feb-07 2:58
membersswater shi13-Feb-07 2:58 
AnswerRe: problem with outlook Pin
vice13-Feb-07 3:52
membervice13-Feb-07 3:52 
GeneralRe: problem with outlook Pin
sswater shi13-Feb-07 22:57
membersswater shi13-Feb-07 22:57 
GeneralRe: problem with outlook Pin
pengchengwanli4-Dec-09 19:49
memberpengchengwanli4-Dec-09 19:49 
GeneralRe: problem with outlook Pin
pengchengwanli4-Dec-09 19:44
memberpengchengwanli4-Dec-09 19:44 
AnswerRe: problem with outlook Pin
pengchengwanli4-Dec-09 19:46
memberpengchengwanli4-Dec-09 19:46 
GeneralGreat ! + possible error Pin
ChrisRibe22-Mar-06 9:37
memberChrisRibe22-Mar-06 9:37 
GeneralRe: Great ! + possible error Pin
sswater shi22-Mar-06 14:39
membersswater shi22-Mar-06 14:39 
GeneralGOOD Pin
pengchengwanli5-Dec-09 21:56
memberpengchengwanli5-Dec-09 21:56 
GeneralIE Access violation for CF_BITMAP Pin
jnettleton2-Dec-05 7:56
memberjnettleton2-Dec-05 7:56 
GeneralRe: IE Access violation for CF_BITMAP Pin
sswater shi3-Dec-05 22:00
membersswater shi3-Dec-05 22:00 
GeneralCF_ENHMETAFILE Pin
FlyZu10-Nov-05 3:23
memberFlyZu10-Nov-05 3:23 
AnswerRe: CF_ENHMETAFILE Pin
sswater shi13-Nov-05 16:57
membersswater shi13-Nov-05 16:57 
GeneralRe: CF_ENHMETAFILE Pin
FlyZu14-Nov-05 0:00
memberFlyZu14-Nov-05 0:00 
QuestionHow to do it in c# Pin
nagarsoft13-Oct-05 12:49
membernagarsoft13-Oct-05 12:49 
AnswerRe: How to do it in c# Pin
sswater shi13-Oct-05 17:21
membersswater shi13-Oct-05 17:21 
GeneralRe: How to do it in c# Pin
nagarsoft13-Oct-05 21:01
membernagarsoft13-Oct-05 21:01 
GeneralRe: How to do it in c# Pin
sswater shi13-Oct-05 21:47
membersswater shi13-Oct-05 21:47 
AnswerRe: How to do it in c# Pin
nagarsoft14-Oct-05 7:19
membernagarsoft14-Oct-05 7:19 
GeneralVery useful class - thanks a lot! Pin
vkurdukov20-Sep-05 2:43
membervkurdukov20-Sep-05 2:43 
GeneralRe: Very useful class - thanks a lot! Pin
sswater shi20-Sep-05 17:45
membersswater shi20-Sep-05 17:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150520.1 | Last Updated 20 Sep 2005
Article Copyright 2005 by sswater shi
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid