How to Make a Desktop Gadget

Microsoft introduced its own version of a widget, a tiny program running on the desktop, in the Vista operating system as part of the "Sidebar" feature. The current Windows operating system, Windows 7, does not include a Sidebar. Microsoft now refers to these little programs as "Desktop Gadgets." The user can drag gadgets anywhere on the desktop. Developing your own gadgets involves creating at a minimum two short files, an XML file and an HTML file. Adding some JavaScript, either as part of the HTML code or in a separate file, allows more customization.

Things You'll Need

  • Windows 7
Show More

Instructions

    • 1

      Create your first gadget using as an example a countdown to your retirement. Click "Start," type "Notepad" and press "Enter" to open the Notepad program included in Windows. Enter the following lines:

      <html>

      <head>

      <title>My Retirement</title>

      <style>

      body{width:120;height:120;font:8 pt Arial;color:white; filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=1, StartColorStr="#00FF00",

      EndColorStr="#0000FF")}

      </style>

      <link href="style.css" rel="stylesheet" type="text/css" />

      <script language="javascript">

      RightNow = new Date()

      mil = new Date("Jan. 31, 2030")

      mil.setYear = RightNow.getFullYear;

      day = (1000*60*60*24)

      computeDay = (mil.getTime() - RightNow.getTime()) / day;

      computeDAY = computeDay-1

      DayResult = Math.round(computeDay);

      document.write("<center> "+DayResult+" days until you retire (Jan. 31, 2030)</center>");

      </script>

      </head>

      <body>

      </body>

      </html>

      Substitute the date of your retirement for the one in the example.

    • 2

      Click on "File" and then "Save as." Use Windows Explorer to navigate to the Gadgets folder located at "Users/[your profile name]/AppData/Local/Microsoft/Windows Sidebar/Gadgets." Save the file in this folder as "MyRetirement.html." In the "Save as type" box, use the drop-down arrow to change from the default "Text Documents (*.txt)" to "All Files (*.*)."

    • 3

      Develop the XML file by opening a new file in Notepad. Enter the following lines:

      <?xml version="1.0" encoding="utf-8" ?>

      <gadget>

      <name>MyRetirement</name>

      <version>1.0.0.0</version>

      <author name= [enter your name in quotes] </author>

      <description>"MyRetirement" MyRetirement</description>

      <hosts>

      <host name="sidebar">

      <base type="HTML" apiVersion="1.0.0" src="MyRetirement.html" />

      <permissions>Full</permissions>

      <platform minPlatformVersion="1.0" />

      </host>

      </hosts>

      </gadget>

    • 4

      Save this file in the same gadgets folder as the HTML file. Change the file name to "MyRetirement.xml" and the type to "All Files (*.*)."

    • 5

      Prepare the gadget for installation on other computers. Select both files in the Gadgets folder by holding down the "Ctrl" key and clicking on them. Right-click and select "Send to compressed (zip) folder." Use the same name, "MyRetirement," and the same folder as in Steps 3 and 5. Right-click on the new zipped file and select "Rename." Change the extension from "zip" to "gadget." This allows Windows to recognize the compressed files as a gadget and install them. A user now can double-click on the new gadget file to install it.

    • 6

      Open the "Gadgets" item found in a drop-down list when you right-click anywhere on the desktop. This displays all installed gadgets. Click and drag your new gadget anywhere you like on the screen.

Tips & Warnings

  • Add an icon to the gadget by inserting a line reading "<img src="GoneFishing.png" height="36" width="36" </>" between the "<body>" and "</body>" in the HTML file. Replace the "GoneFishing.png" icon file with one of your own devising.

  • Organize your gadgets by creating a sub-folder with the name of the gadget under the "Windows Sidebar/Gadgets" folder described in Step 3.

  • A second way to distribute your gadgets is as a CAB file by downloading the Microsoft free compression utility "Cabarc.exe," described on the Microsoft Cabinet Software Development Kit page (see Resources).

  • When installing a gadget, Windows may warn you about the possibility of a harmful file. If you trust the source, you can ignore this. Many gadgets do not bother getting Microsoft security certification.

Related Searches:

References

Resources

Comments

You May Also Like

  • How to Download Gadgets in Windows 7

    Gadgets in Windows 7 allow you to download customizable information on your desktop, such as pictures, weather, news, music and games. Previously...

  • How to Create a Vista Sidebar Gadget

    Microsoft's release of Windows Vista was its first new operating system launch in over five years. Vista followed Windows XP and included...

  • How to Make Spy Gadgets

    Surveillance equipment and spy gadgets have become increasingly more sophisticated. With the creation of spy movies, the excitement for spy gadgets continues...

  • How to Create A Vista Gadget

    One of Windows Vista's most notable upgrades from previous versions is the optional Windows Sidebar. This program displays widgets that Microsoft calls...

  • How to Create a Windows Gadget

    Windows gadgets are the application icons that appear in the Windows sidebar. These gadgets direct users to applications that are installed on...

  • Desktop Tricks for the Windows Vista Sidebar

    Microsoft introduced the Windows Sidebar with the Windows Vista operating system in 2006. The sidebar feature continues as a main component of...

  • How to Use Desktop Gadgets in Vista

    Microsoft Windows Vista comes with many pre-installed gadgets that automatically update to keep you up to date on the weather, news, stocks...

  • How to Choose Desktop Gadgets in Windows Vista

    Because Windows Vista differs substantially from other versions of Windows, many people are unaware of some of its best features. For instance,...

Related Ads

Featured