Simple Clipboard Class

This simple class gives you a group of three static functions that give you the power to use the clipboard for text. You can now implement cut, copy, and paste in your text-based application with ease, without worrying about the little details of clipboard work. These functions are all static, meaning you don't need to actually instantiate the class to use them.

There are three functions available:

CClipboard::SetText()
   This function puts text on the clipboard.

CClipboard::GetText()
   This function retrieves text from the clipboard.

CClipboard::GetTextLength()
   This function retrieves the length of the text on the clipboard.

If any of these functions return FALSE, then there was an error during the clipboard operation; otherwise, the operation was successful. In the future, I'd like to expand this into a more robust clipboard control class, perhaps using some of the other code that exists here on Codeguru. If anyone would like to take a stab at that before I do, please send your results back up when you have something!

Here is an example of how this class might be used:


#include "Clipboard.h"

         :
         :
         :

        // Write text to the clipboard
        char pastebuf[256];
        strcpy (pastebuf, "Put this on the clipboard.");
        CClipboard::SetText(strText);

         :
         :
         :

        // Retrieve text from the clipboard
        char copybuf[256];
        CClipboard::GetText(copybuf, 256);



Download demo project - 13 KB

Download source - 3 KB



Comments

  • guys opinion on belly button rings

    Posted by vandelaydessign.com on 12/12/2012 01:47pm

    By WebOsPublisher Free icons in ico format. Desktop icons - aquarium,cats,birds,nature,blanks,computer,flags,road signs,chips,christmas,erotic,sexy icons Free Windows icons, desktop icons, clip art Your name: Your e-mail: Stock Icons Toolbar Icons Business Icons Toolbar Icons Windows 7 Icons Free Icon Editor Medical Icons Icon Editor Find Icons Toons Icons for Children - collected by Icon News Hercules Icon Pack - collected by Iconok.Net Simpson's Pack 1 - collected by Spring Field Simpson's Pack 2 - collected by Spring Field Home | Products | Download | Order | Icons | Support Copyright © 2005-2012 Icon Empire. All rights reserved. Tweet Icon Craft is our pick. This icon maker allows you to design and edit all kinds of graphics required in the software development cycle, including icons, static and animated cursors and interface elements - all these kinds of graphics can now be designed in a single application. More info Icon Processor is an icon converter. It creates icons from your images. It is possible to convert 256-color icons into True Color icons and XP icons. More info ICL-Icon Extractor will scan your files, archives, folders and all local disks for icons. It can download icons from the Internet and customize Windows icons. More info Perfect Icon creates icons from any graphic file (PNG, JPEG, BMP, TIFF, WMF and more) in just seconds. Create stylish icons for Windows XP. Easily replace, colorize and save icons that Windows uses to display standard objects, folders and files. More info Pixel Editor is a program to create and edit images for websites or mobile devices. An array of tools to work with pictures and simplicity of use make this product ideal for newbies and graphic design professionals alike. More info

    Reply
  • GetTextLength() can't be used

    Posted by Legacy on 04/18/2002 12:00am

    Originally posted by: lake

       in the GetTextLength() ,
    
    

    nSize = GlobalSize(hGlobal) is used to show memery size,it usual > = Text Length ;

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Thanks to wide spread cloud hosting and innovations small businesses can meet and exceed the legacy systems of goliath corporations. Explore the freedom to work how you want, with a phone system that will adapt to your evolving needs and actually save you lots of expense—read Get an Enterprise Phone System without High Cost and Complexity. The article clearly illustrates: The only hardware you'll need is phone equipment for advanced voice and fax. How to join all your employees, mobile devices, …

  • For the first time in modern history, workplace demographics now span four generations. Understanding the unique social influences that have shaped the behaviors of each is instrumental in creating productive work teams. And when managed effectively, their strengths, perspectives, and experiences can bring synergy in the workplace. Download this white paper for best practices on how to better understand and effectively manage a multi-generational workforce.

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date