Guide to creating gadgets in Windows 7

In the following article, we will show you some basic tasks to create Gadgets - a small form of applications that are supported in Windows Vista and Windows 7. A very special feature of gadgets is possible Set anywhere on the Desktop, quickly provide users with the necessary information, or act as a 'door' to the website or a number of other large-scale programs and applications. than.

TipsMake.com - In the following article, we will introduce you some basic steps to create Gadget - a small application form, supported in Windows Vista and Windows 7. A very specific point of Gadgets can be placed anywhere on the Desktop, quickly providing users with the necessary information, or acting as a 'door' to the website or some other programs and applications. have a larger scale.

In essence, these gadgets are just a miniature HTML page, which means there is no need to use technologies or require advanced programming skills to create gadgets. Even you only need NotePad and some basic knowledge of HTML can do this.

Guide to creating gadgets in Windows 7 Picture 1Guide to creating gadgets in Windows 7 Picture 1
Example of Gadget on Windows 7

And here are the basic steps for creating simple Gadget:

  1. Create a new HTML page, named gadgetName.html
  2. Create a new XML file, named gadget.xml
  3. Copy those 2 files into a specific folder. For example:
 userDirAppDataLocalMicrosoftWindows SidebarGadgetsgadgetName.gadget 

Instructions for creating detailed Gadget

Below is the details we need to do.

Step 1: Create a new folder on the desktop and name it HelloGadget.gadget

Step 2: Open the newly created folder and continue to create 2 new files. This is the source code of the gadget.xml file:



HelloGadget
1.0.0.0
Hello World Gadget.



Full


However, there is one point that can confuse many people, which is the name of the HTML file in the code:

 

And below is the code for that HelloGadget.html file:




Hello World!

Step 3: Open Windows Explorer and select the following folder:

 userDirAppDataLocalMicrosoftWindows SidebarGadgets 

Here, userDir is the account name in use. Otherwise, copy directly through the following link:

 % localappdata% MicrosoftWindows SidebarGadgets 

In this folder, we will see all the gadgets installed, each of which has a file with an extension of .gadget (if you want to learn more about the nature of gadgets, open it. and see the source code with NotePad).

Step 4: Drag and drop the HelloGadget.gadget folder directly from the desktop to the above folder.

Guide to creating gadgets in Windows 7 Picture 2Guide to creating gadgets in Windows 7 Picture 2

To check, right-click on the desktop and select Gadgets, at this point we will see the HelloGadget in the displayed list:

Guide to creating gadgets in Windows 7 Picture 3Guide to creating gadgets in Windows 7 Picture 3
Gadget has a default icon, but the name is already set in the XML file

So basically, we have completed some basic steps to create gadgets. But this is just the beginning, there are many things that can be done if we find out more.

The debug process

Multi-purpose JavaScript debugging tool, most commonly used is the alert () function, which is not available when running as a widget. So to debug, drag and drop the HTML file into the web browser and run it, where the alert () function will work normally.

In Windows 7, there is a Registry key that directly affects this debug process:

 [HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionSidebar] 
"ShowScriptErrors" = dword: 00000001

The above settings will trigger notifications when an error occurs.

If you use Visual Studio, you can use the Just-In-Time feature by inserting the code:

 debugger; 

at the beginning of each segment

5 ★ | 2 Vote