Click here to Skip to main content
5,790,650 members and growing! (18,286 online)
Email Password   helpLost your password?
Desktop Development » Clipboard » General     Intermediate License: The Code Project Open License (CPOL)

Clipboard backup (Visual C++)

By sswater shi

Make a backup copy of clipboard data before your clipboard operation, and when you finish, you can restore clipboard to its original status.
VC6, C++Windows, Win2K, WinXP, Win2003VS6, Visual Studio, Dev

Posted: 20 Aug 2005
Updated: 20 Sep 2005
Views: 68,086
Bookmarked: 34 times
Announcements
Loading...



Search    
Advanced Search
Sitemap
21 votes for this Article.
Popularity: 5.63 Rating: 4.26 out of 5
3 votes, 14.3%
1
1 vote, 4.8%
2
0 votes, 0.0%
3
3 votes, 14.3%
4
14 votes, 66.7%
5

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 :) :

License

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

About the Author

sswater shi


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/
Occupation: Web Developer
Location: China China

Other popular Clipboard articles:

Article Top
Sign Up to vote for this article
You must Sign In to use this message board.
FAQ FAQ Noise ToleranceSearch Search Messages 
 Layout  Per page   
 Msgs 1 to 22 of 22 (Total in Forum: 22) (Refresh)FirstPrevNext
GeneralProblem with CF_BITMAPmemberMohammadAmiry14:06 28 Mar '07  
GeneralRe: Problem with CF_BITMAPmembersswater shi15:36 28 Mar '07  
Questionproblem with outlookmembervice7:53 12 Feb '07  
AnswerRe: problem with outlookmembersswater shi2:58 13 Feb '07  
AnswerRe: problem with outlookmembervice3:52 13 Feb '07  
GeneralRe: problem with outlookmembersswater shi22:57 13 Feb '07  
GeneralGreat ! + possible errormemberChrisRibe9:37 22 Mar '06  
GeneralRe: Great ! + possible errormembersswater shi14:39 22 Mar '06  
GeneralIE Access violation for CF_BITMAPmemberjnettleton7:56 2 Dec '05  
GeneralRe: IE Access violation for CF_BITMAPmembersswater shi22:00 3 Dec '05  
GeneralCF_ENHMETAFILEmemberFlyZu3:23 10 Nov '05  
AnswerRe: CF_ENHMETAFILEmembersswater shi16:57 13 Nov '05  
GeneralRe: CF_ENHMETAFILEmemberFlyZu0:00 14 Nov '05  
QuestionHow to do it in c#membernagarsoft12:49 13 Oct '05  
AnswerRe: How to do it in c#membersswater shi17:21 13 Oct '05  
GeneralRe: How to do it in c#membernagarsoft21:01 13 Oct '05  
GeneralRe: How to do it in c#membersswater shi21:47 13 Oct '05  
AnswerRe: How to do it in c#membernagarsoft7:19 14 Oct '05  
GeneralVery useful class - thanks a lot!membervkurdukov2:43 20 Sep '05  
GeneralRe: Very useful class - thanks a lot!membersswater shi17:45 20 Sep '05  
General#include <afxtempl.h> is needed.membersswater shi16:56 23 Aug '05  
GeneralRe: #include <afxtempl.h> is needed.memberlxdff17:25 23 Aug '05  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 20 Sep 2005
Editor: Smitha Vijayan
Copyright 2005 by sswater shi
Everything else Copyright © CodeProject, 1999-2009
Web15 | Advertise on the Code Project