Click here to Skip to main content
Licence CPOL
First Posted 20 Aug 2005
Views 105,436
Downloads 581
Bookmarked 47 times

Clipboard backup (Visual C++)

By sswater shi | 20 Sep 2005
Make a backup copy of clipboard data before your clipboard operation, and when you finish, you can restore clipboard to its original status.
4 votes, 17.4%
1
1 vote, 4.3%
2

3
3 votes, 13.0%
4
15 votes, 65.2%
5
4.57/5 - 23 votes
3 removed
μ 4.20, σa 2.57 [?]

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

Software Developer (Senior)

China China

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/

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralMy vote of 1 PinmemberAdminSam20:20 18 Jan '12  
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  
GeneralRe: problem with outlook Pinmemberpengchengwanli19:49 4 Dec '09  
GeneralRe: problem with outlook Pinmemberpengchengwanli19:44 4 Dec '09  
AnswerRe: problem with outlook Pinmemberpengchengwanli19:46 4 Dec '09  
GeneralGreat ! + possible error PinmemberChrisRibe9:37 22 Mar '06  
GeneralRe: Great ! + possible error Pinmembersswater shi14:39 22 Mar '06  
GeneralGOOD Pinmemberpengchengwanli21:56 5 Dec '09  
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 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.

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