With Windows Vista right around the corner, Windows developers have a lot to
look forward to. With a whole new .NET Framework (3.0) that consists of a number
of new technologies and platforms, there is a lot that developers need to learn
and implement. We will take a look at the new features in the months to come.
But, in this article, we'll start with something new but simple and familiar
to work with. This is developing gadgets for the new Vista Sidebar.
The Sidebar is a new application in Windows Vista that hosts a number of
small applications, termed as gadgets, which perform a single task at a time.
For instance, one gadget could show an analog clock, another could get RSS feeds
and yet another can provide a calculator for you to be able to use at any time.
You can add more gadgets to the Sidebar from the machine's Gadget Gallery or
download new ones from the Internet.
|
Gadgets are basically a set of scripts that are hosted by the Sidebar
application. To develop a gadget, it must be created in a special folder-namely,
C:\Users\
folder, for every gadget you intend to develop, a new folder needs to be created
in the following format:
creating a “Hello World” gadget, the name of the folder can be Hello.gadget.
In this article, we'll create a slightly more useful gadget-a system uptime
monitor. For this, let's create a new folder called Uptime.gadget in the above
folder.
Within each gadget, there are a number of files that constitute different
parts of a gadget. The first and the most important one is the gadget.xml file.
This sets the gadget you are creating. In our case, our gadget.xml can look like
this:
A sidebar gadget like this is just a simple HTML page with some in-line script |
encoding="utf-8" ?>
The manifest basically sets information about the gadget such as the name,
description, copyright, author, logos, icons, etc. One of the most important
parts of the manifest is the “base”. In this line, the “src” attribute
sets the name of the HTML file that actually supplies the gadget UI and action.
Yes, a Sidebar gadget is nothing but a simple HTML page with some inline script
within. There is, however a big Sidebar object model that you have access to and
allows a lot of interactivity, some of which will be seen later in this article.
Different gadgets you can create in Vista |
So, obviously the next step is to create the HTML file specified above-Uptime.html.
This is a normal HTML file that contains some script as well. For this file, we'll
create the script in VBScript. This is what the first version looks like:
Uptime