Home » » How to create widget for win 7

How to create widget for win 7

How to Create a Gadget (the short version):
Here's all you need to do to create your own gadget:

1) Write an HTML page, say gadgetName.html

2) Write a short XML file, named (exactly) gadget.xml

3) Copy these two files into a particular directory:
   userDir \ AppData\Local\Microsoft\Wi
ndows Sidebar\Gadgets\ gadgetName.gadget

The Details:
Follow these steps and you'll have a new gadget in a few minutes:

1
Create a new folder on your desktop and name it
HelloGadget.gadget

2
Open that folder and create two files in that folder.  Here's the XML file (called a manifest):

gadget.xml
<?xml version="1.0" encoding="utf-8" ?>
<gadget>
  <name>HelloGadget</name>
  <version>1.0.0.0</version>
  <description>Hello World Gadget.</description>
  <hosts>
    <host name="sidebar">
      <base type="HTML" apiVersion="1.0.0" src="HelloGadget.html" />
      <permissions>Full</permissions>
      <platform minPlatformVersion="1.0" />
    </host>
  </hosts>
</gadget>
                                    

About the only place you might go wrong is misspelling the name of the HTML file in the
    <base type="HTML" apiVersion="1.0.0" src="HelloGadget.html" />
line.  Here's that HTML file:

HelloGadget.html
<html>
<script>
//----------------- resizes the gadget display surface
function DoInit() {
    document.body.style.width = 90;
    document.body.style.height= 55;
    document.body.style.margin=0;
}
</script>
<body onload="DoInit();">
<table border="5"><tr><td><center><i>Hello World!</i></center></td></tr></table>
</body>
</html>
                                    
3
Open a Windows Explorer and drill-down to locate the
following folder:

   userDir \ AppData\Local\Microsoft\Windows Sidebar\Gadgets\

...where userDir is your Windows User Name (the folder is in the "Desktop" virtual folder, just above "Computer" ) If you want, you can copy the following text and paste it into the address bar in any Explorer window (or in the Start/Search or Start/Run input boxes):
%localappdata%\Microsoft\Windows Sidebar\Gadgets
                                    
1:
Looking in that folder, you will see the other gadgets that are already installed.  Each is in a folder that has a file extension of .gadget  A good way to learn about gadget programming is to examine the source files of the gadgets you can download from the Microsoft site.

4
Drag the HelloGadget.gadget folder from the desktop
and drop it into that Gadgets directory.
  • Fig. 1-2: Gadgets Folder
Fig. 1-2: Gadgets Folder
5
Right-click the desktop and select Gadgets.
Your gadget is now visible in the gallery.
  • Fig. 1-3: Your gadget in the Gallery
Fig. 1-3:  Your gadget in the Gallery
It has the default icon, but the name is as was set in the XML file.  Drag it and drop it onto your desktop.

There you have it:  Your first gadget.  About all you can do with it is drag it around and close it.  But that's a start.  You can open the HTML file with your favorite text editor, make changes, and then drag it from the gallery to the desktop to see the effects of your change

0 comments:

Post a Comment

http://i1227.photobucket.com/albums/ee434/jackcrausher/images-2.jpg
WidgetAutomotive hi-tech

Popular Posts

List news


widgeo.net
 
Support : Your Link | Publish to publish | Thank's's for visiting this blog
Copyright © 2013. Publish to publish - All Rights Reserved
Template Created by Creating Website Published by Automotive hi-tech--avenueserenade.blogspot.com
Proudly powered by Blogger