如何开始使用Windows 7小工具

时间:2021-07-31 02:30:06

I have never programmed a gadget for Vista or Seven, but I would like to try to make one. But where do I start? I have tried to search around on google and msdn, but I haven't managed to find anything useful. Either very, very old stuff (Vista beta stuff), already made gadgets or differences between gadgets in Vista and Seven. But that doesn't help me, since I don't have a clue how to make a gadget in the first place... I haven't even managed to find out what they are written in...

我从未为Vista或Seven编写过小工具,但我想尝试制作一个。但是我从哪里开始呢?我试图在谷歌和msdn上搜索,但我没有找到任何有用的东西。无论是非常非常古老的东西(Vista测试版的东西),已经制作了小工具或Vista和Seven中的小工具之间的差异。但这对我没有帮助,因为我不知道如何制作一个小工具......我甚至没有设法找出他们写的是什么......

So, could anyone help me out with a kick start?

那么,任何人都可以帮助我一开始吗?

  • Where do I start?
  • 我从哪里开始?

  • What do I need to know?
  • 我需要知道什么?

  • What are they written in?
  • 他们写的是什么?

  • How are they "packaged"?
  • 他们是如何“打包”的?

In other words, how do I get from a clean install of Windows 7 with Visual Studio to a working Gadget that I can install and put on my Windows 7 desktop.

换句话说,如何从使用Visual Studio的Windows 7的干净安装到我可以安装并放在Windows 7桌面上的工作小工具。

4 个解决方案

#1


Here's an MSDN article on Vista Gadgets. Some preliminary documentation on 7 gadgets, and changes. I think the only major changes are that Gadgets don't reside in the Sidebar anymore, and as such "dock/undock events" are now backwards-compatibility cludges that really shouldn't be used.

这是关于Vista Gadgets的MSDN文章。关于7个小工具和更改的一些初步文档。我认为唯一的主要变化是小工具不再存在于补充工具栏中,因此“停靠/取消停靠事件”现在是向后兼容的问题,实际上不应该使用。

Best way to get started is probably to just tweak an existing gadget. There's an example gadget in the above link, or you could pick a different one out on your own.

最好的入门方式可能只是调整现有的小工具。上面的链接中有一个示例小工具,或者您可以自己选择不同的小工具。

Gadgets are written in HTML, CSS, and some IE scripting language (generally Javascript, but I believe VBScript also works). For really fancy things you might need to create an ActiveX object, so C#/C++ for COM could be useful to know.

小工具是用HTML,CSS和一些IE脚本语言编写的(通常是Javascript,但我相信VBScript也有效)。对于您可能需要创建ActiveX对象的真正奇特的东西,因此用于COM的C#/ C ++可能很有用。

Gadgets are packaged as ".gadget" files, which are just renamed Zip archives that contain a gadget manifest (gadget.xml) in their top level.

小工具打包为“.gadget”文件,这些文件刚刚重命名为Zip档案,其顶层包含小工具清单(gadget.xml)。

#2


Combining and organizing all the current answers into one answer, then adding my own research:

将所有当前答案组合并组织成一个答案,然后添加我自己的研究:

Brief summary of Microsoft gadget development:

Microsoft小工具开发简介:

What are they written in? Windows Vista/Seven gadgets are developed in a mix of XML, HTML, CSS, and some IE scripting language. It is also possible to use C# with the latest release of Script#.

他们写的是什么? Windows Vista / Seven小工具是以XML,HTML,CSS和一些IE脚本语言混合开发的。也可以将C#与最新版本的Script#一起使用。

How are they packaged/deployed? The actual gadgets are stored in *.gadget files, which are simply the text source files listed above compressed into a single zip file.

它们是如何打包/部署的?实际的小工具存储在* .gadget文件中,这些文件只是将上面列出的文本源文件压缩成单个zip文件。

Useful references for gadget development:

小工具开发的有用参考:

where do I start? Good introductory references to Windows Vista/Seven gadget development:

我从哪里开始?对Windows Vista / Seven小工具开发的良好介绍性参考:

If you are willing to use offline resources, this book appears to be an excellent resource:

如果您愿意使用离线资源,这本书似乎是一个很好的资源:

What do I need to know? Some other useful references; not necessarily instructional

我需要知道什么?一些其他有用的参考;不一定是教学


Update: Well, this has proven to be a popular answer~ Sharing my own recent experience with Windows 7 gadget development:

更新:嗯,这已被证明是一个受欢迎的答案〜分享我自己最近使用Windows 7小工具开发的经验:

Perhaps the easiest way to get started with Windows 7 gadget development is to modify a gadget that has already been developed. I recently did this myself because I wanted a larger clock gadget. Unable to find any, I tinkered with a copy of the standard Windows clock gadget until it was twice as large. I recommend starting with the clock gadget because it is fairly small and well-written. Here is the process I used:

开始使用Windows 7小工具开发的最简单方法可能是修改已经开发的小工具。我最近自己做了这个,因为我想要一个更大的时钟小工具。无法找到任何内容,我修改了标准Windows时钟小工具的副本,直到它的两倍大。我建议从时​​钟小工具开始,因为它相当小并且写得很好。这是我使用的过程:

  1. Locate the gadget you wish to modify. They are located in several different places. Search for folders named *.gadget. Example: C:\Program Files\Windows Sidebar\Gadgets\Clock.Gadget\
  2. 找到您要修改的小工具。它们分布在几个不同的地方。搜索名为* .gadget的文件夹。示例:C:\ Program Files \ Windows Sidebar \ Gadgets \ Clock.Gadget \

  3. Make a copy of this folder (installed gadgets are not wrapped in zip files.)
  4. 制作此文件夹的副本(已安装的小工具不包含在zip文件中。)

  5. Rename some key parts:
    1. The folder name
    2. 文件夹名称

    3. The name inside the gadget.xml file. It looks like:<name>Clock</name> This is the name that will be displayed in the "Gadgets Gallery" window.
    4. gadget.xml文件中的名称。它看起来像: Clock 这是将在“Gadgets Gallery”窗口中显示的名称。

  6. 重命名一些关键部分:文件夹名称gadget.xml文件中的名称。它看起来像: Clock 这是将在“Gadgets Gallery”窗口中显示的名称。

  7. Zip up the entire *.gadget directory.
  8. 压缩整个* .gadget目录。

  9. Change the file extension from "zip" to "gadget" (Probably just need to remove the ".zip" extension.)
  10. 将文件扩展名从“zip”更改为“gadget”(可能只需要删除“.zip”扩展名。)

  11. Install your new copy of the gadget by double clicking the new *.gadget file. You can now add your gadget like any other gadget (right click desktop->Gadgets)
  12. 双击新的* .gadget文件,安装小工具的新副本。您现在可以像任何其他小工具一样添加小工具(右键单击桌面 - >小工具)

  13. Locate where this gadget is installed (probably to %LOCALAPPDATA%\Microsoft\Windows Sidebar\)
  14. 找到此小工具的安装位置(可能是%LOCALAPPDATA%\ Microsoft \ Windows Sidebar \)

  15. Modify the files in this directory. The gadget is very similar to a web page: HTML, CSS, JS, and image files. The gadget.xml file specifies which file is opened as the "index" page for the gadget.
  16. 修改此目录中的文件。小工具与网页非常相似:HTML,CSS,JS和图像文件。 gadget.xml文件指定将哪个文件作为小工具的“索引”页面打开。

  17. After you save the changes, view the results by installing a new instance of the gadget. You can also debug the JavaScript (The rest of that article is pretty informative, too).
  18. 保存更改后,通过安装小工具的新实例来查看结果。您也可以调试JavaScript(该文章的其余部分也非常有用)。

#3


Here's an excellent article by Scott Allen: Developing Gadgets for the Windows Sidebar

这是Scott Allen撰写的一篇优秀文章:为Windows边栏开发小工具

This site, Windows 7/Vista Sidebar Gadgets, has links to many gadget resources.

此站点是Windows 7 / Vista边栏小工具,它包含许多小工具资源的链接。

#4


I have started writing one tutorial for everyone on this topic, see making gadgets for Windows 7.

我已经开始为这个主题为每个人编写一个教程,请参阅为Windows 7制作小工具。

#1


Here's an MSDN article on Vista Gadgets. Some preliminary documentation on 7 gadgets, and changes. I think the only major changes are that Gadgets don't reside in the Sidebar anymore, and as such "dock/undock events" are now backwards-compatibility cludges that really shouldn't be used.

这是关于Vista Gadgets的MSDN文章。关于7个小工具和更改的一些初步文档。我认为唯一的主要变化是小工具不再存在于补充工具栏中,因此“停靠/取消停靠事件”现在是向后兼容的问题,实际上不应该使用。

Best way to get started is probably to just tweak an existing gadget. There's an example gadget in the above link, or you could pick a different one out on your own.

最好的入门方式可能只是调整现有的小工具。上面的链接中有一个示例小工具,或者您可以自己选择不同的小工具。

Gadgets are written in HTML, CSS, and some IE scripting language (generally Javascript, but I believe VBScript also works). For really fancy things you might need to create an ActiveX object, so C#/C++ for COM could be useful to know.

小工具是用HTML,CSS和一些IE脚本语言编写的(通常是Javascript,但我相信VBScript也有效)。对于您可能需要创建ActiveX对象的真正奇特的东西,因此用于COM的C#/ C ++可能很有用。

Gadgets are packaged as ".gadget" files, which are just renamed Zip archives that contain a gadget manifest (gadget.xml) in their top level.

小工具打包为“.gadget”文件,这些文件刚刚重命名为Zip档案,其顶层包含小工具清单(gadget.xml)。

#2


Combining and organizing all the current answers into one answer, then adding my own research:

将所有当前答案组合并组织成一个答案,然后添加我自己的研究:

Brief summary of Microsoft gadget development:

Microsoft小工具开发简介:

What are they written in? Windows Vista/Seven gadgets are developed in a mix of XML, HTML, CSS, and some IE scripting language. It is also possible to use C# with the latest release of Script#.

他们写的是什么? Windows Vista / Seven小工具是以XML,HTML,CSS和一些IE脚本语言混合开发的。也可以将C#与最新版本的Script#一起使用。

How are they packaged/deployed? The actual gadgets are stored in *.gadget files, which are simply the text source files listed above compressed into a single zip file.

它们是如何打包/部署的?实际的小工具存储在* .gadget文件中,这些文件只是将上面列出的文本源文件压缩成单个zip文件。

Useful references for gadget development:

小工具开发的有用参考:

where do I start? Good introductory references to Windows Vista/Seven gadget development:

我从哪里开始?对Windows Vista / Seven小工具开发的良好介绍性参考:

If you are willing to use offline resources, this book appears to be an excellent resource:

如果您愿意使用离线资源,这本书似乎是一个很好的资源:

What do I need to know? Some other useful references; not necessarily instructional

我需要知道什么?一些其他有用的参考;不一定是教学


Update: Well, this has proven to be a popular answer~ Sharing my own recent experience with Windows 7 gadget development:

更新:嗯,这已被证明是一个受欢迎的答案〜分享我自己最近使用Windows 7小工具开发的经验:

Perhaps the easiest way to get started with Windows 7 gadget development is to modify a gadget that has already been developed. I recently did this myself because I wanted a larger clock gadget. Unable to find any, I tinkered with a copy of the standard Windows clock gadget until it was twice as large. I recommend starting with the clock gadget because it is fairly small and well-written. Here is the process I used:

开始使用Windows 7小工具开发的最简单方法可能是修改已经开发的小工具。我最近自己做了这个,因为我想要一个更大的时钟小工具。无法找到任何内容,我修改了标准Windows时钟小工具的副本,直到它的两倍大。我建议从时​​钟小工具开始,因为它相当小并且写得很好。这是我使用的过程:

  1. Locate the gadget you wish to modify. They are located in several different places. Search for folders named *.gadget. Example: C:\Program Files\Windows Sidebar\Gadgets\Clock.Gadget\
  2. 找到您要修改的小工具。它们分布在几个不同的地方。搜索名为* .gadget的文件夹。示例:C:\ Program Files \ Windows Sidebar \ Gadgets \ Clock.Gadget \

  3. Make a copy of this folder (installed gadgets are not wrapped in zip files.)
  4. 制作此文件夹的副本(已安装的小工具不包含在zip文件中。)

  5. Rename some key parts:
    1. The folder name
    2. 文件夹名称

    3. The name inside the gadget.xml file. It looks like:<name>Clock</name> This is the name that will be displayed in the "Gadgets Gallery" window.
    4. gadget.xml文件中的名称。它看起来像: Clock 这是将在“Gadgets Gallery”窗口中显示的名称。

  6. 重命名一些关键部分:文件夹名称gadget.xml文件中的名称。它看起来像: Clock 这是将在“Gadgets Gallery”窗口中显示的名称。

  7. Zip up the entire *.gadget directory.
  8. 压缩整个* .gadget目录。

  9. Change the file extension from "zip" to "gadget" (Probably just need to remove the ".zip" extension.)
  10. 将文件扩展名从“zip”更改为“gadget”(可能只需要删除“.zip”扩展名。)

  11. Install your new copy of the gadget by double clicking the new *.gadget file. You can now add your gadget like any other gadget (right click desktop->Gadgets)
  12. 双击新的* .gadget文件,安装小工具的新副本。您现在可以像任何其他小工具一样添加小工具(右键单击桌面 - >小工具)

  13. Locate where this gadget is installed (probably to %LOCALAPPDATA%\Microsoft\Windows Sidebar\)
  14. 找到此小工具的安装位置(可能是%LOCALAPPDATA%\ Microsoft \ Windows Sidebar \)

  15. Modify the files in this directory. The gadget is very similar to a web page: HTML, CSS, JS, and image files. The gadget.xml file specifies which file is opened as the "index" page for the gadget.
  16. 修改此目录中的文件。小工具与网页非常相似:HTML,CSS,JS和图像文件。 gadget.xml文件指定将哪个文件作为小工具的“索引”页面打开。

  17. After you save the changes, view the results by installing a new instance of the gadget. You can also debug the JavaScript (The rest of that article is pretty informative, too).
  18. 保存更改后,通过安装小工具的新实例来查看结果。您也可以调试JavaScript(该文章的其余部分也非常有用)。

#3


Here's an excellent article by Scott Allen: Developing Gadgets for the Windows Sidebar

这是Scott Allen撰写的一篇优秀文章:为Windows边栏开发小工具

This site, Windows 7/Vista Sidebar Gadgets, has links to many gadget resources.

此站点是Windows 7 / Vista边栏小工具,它包含许多小工具资源的链接。

#4


I have started writing one tutorial for everyone on this topic, see making gadgets for Windows 7.

我已经开始为这个主题为每个人编写一个教程,请参阅为Windows 7制作小工具。