Click here to Skip to main content
6,595,854 members and growing! (19,522 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.
VC6Win2K, WinXP, Win2003, Dev
Posted:20 Aug 2005
Updated:20 Sep 2005
Views:84,483
Bookmarked:40 times
Announcements
Loading...
 
Search    
Advanced Search
Add to IE Search
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
21 votes for this article.
Popularity: 5.63 Rating: 4.26 out of 5
3 votes, 14.3%
1
1 vote, 4.8%
2

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


Member
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: Software Developer
Location: China China

Other popular Clipboard articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 22 of 22 (Total in Forum: 22) (Refresh)FirstPrevNext
GeneralProblem with CF_BITMAP PinmemberMohammadAmiry14:06 28 Mar '07  
GeneralRe: Problem with CF_BITMAP Pinmembersswater shi15:36 28 Mar '07  
Questionproblem with outlook Pinmembervice7:53 12 Feb '07  
AnswerRe: problem with outlook Pinmembersswater shi2:58 13 Feb '07  
AnswerRe: problem with outlook Pinmembervice3:52 13 Feb '07  
GeneralRe: problem with outlook Pinmembersswater shi22:57 13 Feb '07  
GeneralGreat ! + possible error PinmemberChrisRibe9:37 22 Mar '06  
GeneralRe: Great ! + possible error Pinmembersswater shi14:39 22 Mar '06  
GeneralIE Access violation for CF_BITMAP Pinmemberjnettleton7:56 2 Dec '05  
GeneralRe: IE Access violation for CF_BITMAP Pinmembersswater shi22:00 3 Dec '05  
GeneralCF_ENHMETAFILE PinmemberFlyZu3:23 10 Nov '05  
AnswerRe: CF_ENHMETAFILE Pinmembersswater shi16:57 13 Nov '05  
GeneralRe: CF_ENHMETAFILE PinmemberFlyZu0:00 14 Nov '05  
QuestionHow to do it in c# Pinmembernagarsoft12:49 13 Oct '05  
AnswerRe: How to do it in c# Pinmembersswater shi17:21 13 Oct '05  
GeneralRe: How to do it in c# Pinmembernagarsoft21:01 13 Oct '05  
GeneralRe: How to do it in c# Pinmembersswater shi21:47 13 Oct '05  
AnswerRe: How to do it in c# Pinmembernagarsoft7:19 14 Oct '05  
GeneralVery useful class - thanks a lot! Pinmembervkurdukov2:43 20 Sep '05  
GeneralRe: Very useful class - thanks a lot! Pinmembersswater shi17:45 20 Sep '05  
General#include <afxtempl.h> is needed. Pinmembersswater shi16:56 23 Aug '05  
GeneralRe: #include <afxtempl.h> is needed. Pinmemberlxdff17: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
Web22 | Advertise on the Code Project