Simple clear advice in plain English

Grappling with gadgets

Discover how to create a Windows gadget and some new uses for C++ on the web

Windows Vista supports gadgets; mini-applications you can display on the sidebar or drag to the desktop. Gadgets will also work in Windows 7, now in beta.

They are somewhat improved because they live directly on the desktop and can be displayed at any time using a new desktop peek feature: hover the mouse over the ‘show desktop’ icon at the right end of the Taskbar and application windows become temporarily transparent, letting you inspect any desktop gadgets.

Create a Windows gadget
Gadgets are easy to code and make a fun project. Here is an example called Countdown.The Countdown gadget is great if you have an important event or celebration to look forward to. It counts down the remaining days and alerts you when the moment arrives.

Windows gadgets are HTML applications that consist of two or more files in a folder. In order to be recognised, the folder has to be in a special location. There is a per-machine location and a per-user location, with the latter being the most convenient for development.

Create a folder called countdown.gadget in: ‘%USERPROFILE%\AppData\Local\Microsoft\Windows Sidebar\Gadgets’ where ‘%USERPROFILE%’ is usually ‘c:\users\username’.

You can create a desktop shortcut to this folder.

The most basic gadget is just two files: a manifest and an HTML page. The manifest is a short snippet of XML, which includes the name of the HTML page; the HTML page is the user interface of the gadget itself.

This is rendered by Internet Explorer 7, so there are few limitations on what you can include, though you need a small page size. One interesting possibility is to host Silverlight, though early adopters have found that some workarounds are needed.

A gadget does have access to the local file system and is similar in many respects to a Windows HTML Application (HTA).

The body of the Countdown gadget looks like this:

top: 0; left: 0; z-index: -999; no=repeat;” />



123 days


until what


Reader Comments

   

Add your comment

All fields must be completed. Your email address will not be displayed or used to send marketing messages.

All messages will be checked by moderators before appearing on the site.

See our Privacy Policy for more information.

Related articles

Q&A: Old games, new Windows

Run old PC games on newer operating systems

Hands on: Coding for the desktop

How to develop widgets for the Yahoo Widget Engine, formerly Konfabulator

Hands On - Web development - To Flash or not to Flash

A reader's query about problems with their browser's Back button when using framesets got me thinking about changing web standards. The Back button may seem a minor detail, but the problem...

Question & Answer

Q.How do I stop Windows 7 search?

> Read the answer

Q.Is it a genuine call from Microsoft?

> Read the answer

Q.How can I turn Autoplay back on?

> Read the answer

Best deals on the web

img

Apple MacBook Pro (MC724LL/A)

£999.99- Buy it now

img

Samsung 300E5A-A01DX

£449.99- Buy it now

img

Sony Vaio VPCF23P1E/B

£679.98- Buy it now

Great benefits for subscribers!

Most popular articles

Poll

Which is your preferred web browser

Jargon Buster

Computing terms explained in plain English

Bios

Basic Input Output System. Essential software built into every PC that connects the vital components....

Great shopping deals from Computeractive