Click here to Skip to main content
Licence CPOL
First Posted 20 Aug 2005
Views 107,989
Bookmarked 47 times

Clipboard backup (Visual C++)

By | 20 Sep 2005 | Article
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 :) :

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 PinmemberAdminSam19:20 18 Jan '12  
GeneralProblem with CF_BITMAP PinmemberMohammadAmiry13:06 28 Mar '07  
GeneralRe: Problem with CF_BITMAP Pinmembersswater shi14:36 28 Mar '07  
Questionproblem with outlook Pinmembervice6:53 12 Feb '07  
AnswerRe: problem with outlook Pinmembersswater shi1:58 13 Feb '07  
AnswerRe: problem with outlook Pinmembervice2:52 13 Feb '07  
GeneralRe: problem with outlook Pinmembersswater shi21:57 13 Feb '07  
GeneralRe: problem with outlook Pinmemberpengchengwanli18:49 4 Dec '09  
GeneralRe: problem with outlook Pinmemberpengchengwanli18:44 4 Dec '09  
AnswerRe: problem with outlook Pinmemberpengchengwanli18:46 4 Dec '09  
GeneralGreat ! + possible error PinmemberChrisRibe8:37 22 Mar '06  
GeneralRe: Great ! + possible error Pinmembersswater shi13:39 22 Mar '06  
Thank you very much for your patience on the problem.
 
Yes, I missed an unlock indeed.
 
This class may has other problems too. I am not so sure how to deal with formats such as CF_ENHMETAFILE. Your can refer to former comment "CF_ENHMETAFILE" by Mr FlyZu and the replies.
 
Thanks again. Smile | :)
GeneralGOOD Pinmemberpengchengwanli20:56 5 Dec '09  
GeneralIE Access violation for CF_BITMAP Pinmemberjnettleton6:56 2 Dec '05  
GeneralRe: IE Access violation for CF_BITMAP Pinmembersswater shi21:00 3 Dec '05  
GeneralCF_ENHMETAFILE PinmemberFlyZu2:23 10 Nov '05  
AnswerRe: CF_ENHMETAFILE Pinmembersswater shi15:57 13 Nov '05  
GeneralRe: CF_ENHMETAFILE PinmemberFlyZu23:00 13 Nov '05  
QuestionHow to do it in c# Pinmembernagarsoft11:49 13 Oct '05  
AnswerRe: How to do it in c# Pinmembersswater shi16:21 13 Oct '05  
GeneralRe: How to do it in c# Pinmembernagarsoft20:01 13 Oct '05  
GeneralRe: How to do it in c# Pinmembersswater shi20:47 13 Oct '05  
AnswerRe: How to do it in c# Pinmembernagarsoft6:19 14 Oct '05  
GeneralVery useful class - thanks a lot! Pinmembervkurdukov1:43 20 Sep '05  
GeneralRe: Very useful class - thanks a lot! Pinmembersswater shi16: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
Web04 | 2.5.120529.1 | Last Updated 20 Sep 2005
Article Copyright 2005 by sswater shi
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid