Click here to Skip to main content
12,747,366 members (34,731 online)
Click here to Skip to main content
Add your own
alternative version


10 bookmarked
Posted 30 Mar 2007

XClipboard Gadget

, 30 Mar 2007
Rate this:
Please Sign up or sign in to vote.
XClipboard is a multi item clipboard, that preserves more than one item.

Screenshot - logo_xclipboard.png

Screenshot - screenshot1.png


One of the eye-catching features in Windows Vista is "Windows Side Bar"; it provides so many extensibility points to Windows, and it lets both technical and non-technical people to compose their own Gadgets. I am sure if you have used Vista before, you would know what's meant by Gadget.

A Gadget could be considered as a small application that's running under the context of Windows Side Bar feature. The reason that everyone could create his/her own gadget is that, if one knows only JavaScript and HTML, he/she will be able to create gadgets. I really like the default gadgets that are shipped with Windows Vista, but you definitely need some customizations.

Since I first used Vista, I started thinking about a good idea for a gadget, and after browsing around in CodeProject gadgets section and in Windows Live Gallery, I got to know that most of the released gadgets focus on weather, reading email accounts such as GMail, reading and RSS feed. Despite appreciating these remarkable efforts, honestly it's very hard to come up with an idea that really adds something to Windows Vista. I have been thinking to get one good idea for a gadget. I have already posted a blog entry at my blog asking people around and technology mates to give a good idea for a gadget. Unfortunately I didn't get any response. Then I decided to build a multi item clipboard, and I hope it will help you as it helps me. I am sure you are aware about the necessity or the problem that led to the creation of such a gadget. It simply helps when you copy and paste textual content between various applications or one application instance.


Again, developing gadgets is not a rocket science, everyone can implement his own gadget, but I am convinced that more important than the gadget itself is the need that's behind the gadget creation, and this is the reason, I think, CodeProject provided the Windows Vista Gadgets competition. However to get tuned you just need to know (X)HTML, and JavaScript, that is enough to get started and given below are some useful links that will give you very good information about gadgets development:

Using the code

The code of the XClipboard is quite simple, so I will not explain it. Yet you can go through the code. Actually I will mention here what's done in the gadget code to give a preview about how the XClipboard functions. First and upon loading the gadget, it reads the clipboard content and adds it to one array and then binds the content that has been copied from the system's clipboard into a group of textboxes, and before doing this one function monitors the system's clipboard. This is simply a timed function that fires each 0.5 seconds, it checks the system's clipboard and checks whether the item exists in the XClipboard list. If the item is not in the list, it gets copied and bound to the XClipboard, otherwise it's not copied from the clipboard.

Upon clicking one line item, and here it's worth mentioning that the line item represents one item that has been copied from the clipboard, the item's style gets changed to highlight it. To copy one item to the clipboard and make it the current or recent copy, you will need to doubleclick the item, this will fill the clipboard with this content.

I would like to point out that the code is not that fancy, I have built this XClipboard as an ad-hoc task, I didn't care so much about being generic or well designed, so don't expect to see an ideal code, but on the other hand I see it as acceptable. Moreover the current version supports only 6 items, so the list item length is only 6 items, but it could be generic, I may do it later in future versions.

For a gadget you can have a settings page, in which you set variables for the gadget. I thought about adding this page to the gadget, but then I dropped it, as it is not necessary for the current version. I already added one checkbox that enables and disables the system's clipboard monitoring but then dropped it, as I assumed if the user is loading the gadget into the sidebar then he will be willing to always monitor the system's clipboard. I also added the refresh interval, but then I dropped it as I thought it is not necessary, and I made the default refresh period to 0.5 seconds. This gadget doesn't have a settings page, but hopefully it will have after making it generic, so I may add one variable that controls the length of the clipboard, and consequently the items and UI will be built dynamically.

Points of Interest

The XClipboard gadget is simple and just to the point, I will try to extend it in the future. I would also like to mention that I have got good deal of information from Prayer Times gadget that uses AJAX, and it's really one of the best gadgets I have seen around.

Future Features

XClipboard could be extended to have the following features:

  • Making the gadget more generic, by determining the number of items the gadget can hold, and make it selectable by users in the settings page
  • Adding flyout Window that shows all the contents of one item, in the flyout Window upon selection
  • Adding the settings Window that lets the user enable/disable the clipboard monitoring, and sets the refresh frequency


  • XClipboard v1.1: Removing the line that moves the focus to the line items, upon firing the timer function call, because this always takes the focus to the XClipboard, so if you try to right click the Windows Sidebar at the taskbar, it will disappear continuously.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Kareem Shaker
United Arab Emirates United Arab Emirates
Kareem Shaker is a .NET Architect , He's been working with VC++ and VB since version 4.0 ; Kareem has been working on design and development of many business applications , And he's now spending most of his time working with .NET Framework 1.x and 2.0 using both VB.NET and C# , Kareem has been giving some technical sessions targeted to .NET technologies, One of the technolgoies that I have passion to is EAI, I spend most of my times working on BizTalk Server 2006, I like to share knowledge and to interact with geeks around, Blogging is one of my hobbies, my blog is

You may also be interested in...

Comments and Discussions

-- There are no messages in this forum --
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170215.1 | Last Updated 30 Mar 2007
Article Copyright 2007 by Kareem Shaker
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid