如何开始使用 Windows 7 小工具

发布于 2024-07-20 10:20:28 字数 416 浏览 10 评论 0原文

我从未为 Vista 或 7 编写过小工具,但我想尝试制作一个。 但我该从哪里开始呢? 我尝试在 google 和 msdn 上搜索,但没有找到任何有用的东西。 要么是非常非常老的东西(Vista beta 的东西),已经制作的小工具,要么是 Vista 和 7 中小工具之间的差异。 但这对我没有帮助,因为我一开始就不知道如何制作一个小工具...我什至没有设法找出它们是用什么写的...

所以,有人可以帮忙吗我一开始就出局了吗?

  • 我从哪说起呢?
  • 我需要知道什么?
  • 它们是用什么写的?
  • 它们是如何“包装”的?

换句话说,如何从带有 Visual Studio 的 Windows 7 全新安装转为可以安装并放置在 Windows 7 桌面上的可用小工具。

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...

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

半岛未凉 2024-07-27 10:20:28

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

Microsoft 小工具开发:

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

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

小工具开发的有用参考:

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

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

我需要知道什么? 一些其他有用的参考资料; 不一定是指导性的


更新:嗯,这已经被证明是一个流行的答案~分享我自己最近的Windows 7小工具开发经验:

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

  1. 找到您要修改的小工具。 它们位于几个不同的地方。 搜索名为 *.gadget 的文件夹。 示例:C:\Program Files\Windows Sidebar\Gadgets\Clock.Gadget\
  2. 复制此文件夹(已安装的小工具未包含在 zip 文件中。)
  3. 重命名一些关键部分:
    1. 文件夹名称
    2. gadget.xml 文件中的名称。 它看起来像:Clock 这是将在“小工具库”窗口中显示的名称。
  4. 压缩整个 *.gadget 目录。
  5. 将文件扩展名从“zip”更改为“gadget”(可能只需要删除“.zip”扩展名。)
  6. 双击新的 *.gadget 文件来安装小工具的新副本。 您现在可以像添加任何其他小工具一样添加您的小工具(右键单击桌面 -> 小工具)
  7. 找到此小工具的安装位置(可能是 %LOCALAPPDATA%\Microsoft\Windows Sidebar\
  8. 修改此中的文件目录。 该小工具与网页非常相似:HTML、CSS、JS 和图像文件。 gadget.xml 文件指定打开哪个文件作为小工具的“索引”页面。
  9. 保存更改后,通过安装小工具的新实例来查看结果。 您还可以调试 JavaScript(该文章的其余部分信息也很丰富)。

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

Brief summary of Microsoft gadget development:

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#.

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.

Useful references for gadget development:

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

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:

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:

  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. Make a copy of this folder (installed gadgets are not wrapped in zip files.)
  3. Rename some key parts:
    1. The folder name
    2. 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. Zip up the entire *.gadget directory.
  5. Change the file extension from "zip" to "gadget" (Probably just need to remove the ".zip" extension.)
  6. 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)
  7. Locate where this gadget is installed (probably to %LOCALAPPDATA%\Microsoft\Windows Sidebar\)
  8. 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.
  9. 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).
鹤舞 2024-07-27 10:20:28

这是关于 Vista 小工具 的 MSDN 文章。 有关 7 个小工具和更改的一些初步文档。 我认为唯一的主要变化是小工具不再驻留在侧边栏中,因此“停靠/取消停靠事件”现在是向后兼容的杂物,确实不应该使用。

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

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

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

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.

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.

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

厌味 2024-07-27 10:20:28

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

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

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

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

九歌凝 2024-07-27 10:20:28

我已经开始为每个人编写有关此主题的教程,请参阅制作小工具对于 Windows 7

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文