简体   繁体   English

Windows边栏小工具重新加载

[英]Windows Sidebar Gadget Reload

I am trying to develop a Windows Desktop widget for Windows 7. Just wondering if there is an easy way to reload the widget or have some form of debug code that will reload the widget every 10 seconds. 我正在尝试为Windows 7开发Windows桌面小部件。只是想知道是否有一种简单的方法来重新加载小部件或者有一些形式的调试代码,它将每10秒重新加载一次小部件。

The reason I ask is while developing the widget, if I change anything I need to close the widget and readd to the desktop to show my changes. 我问的原因是在开发小部件时,如果我改变任何东西,我需要关闭小部件并读到桌面以显示我的更改。

Cheers. 干杯。

I do this using a simple batch file that kills sidebar.exe, copies the unzipped gadget files over, and then restarts sidebar.exe. 我使用一个简单的批处理文件来杀死sidebar.exe,复制解压缩的小工具文件,然后重新启动sidebar.exe。 This method also preserves settings between gadget updates. 此方法还会保留小工具更新之间的设置。

This is the batch file. 这是批处理文件。 You'll have to modify src and dst appropriately. 你必须适当地修改src和dst。 You might have to run it from an elevated command prompt if you haven't disabled UAC. 如果尚未禁用UAC,则可能必须从提升的命令提示符运行它。

@setlocal
@echo off

:: Kill the current sidebar process
taskkill /f /im sidebar.exe

:: Update files
set src="%CD%\source"
set dst="%USERPROFILE%\appdata\local\microsoft\windows sidebar\gadgets\YourGadget.gadget"

xcopy /s /y %src% %dst%

:: Relaunch sidebar
start "" "%ProgramFiles%\Windows Sidebar\sidebar.exe"

@endlocal

Do you only need to reload the gadget upon making changes to it? 您是否只需要在更改小工具时重新加载小工具?

In A Heterodox Visual Studio Gadget Template the author has put together a gadget template which has ac# project attached that bundles and deploys your gadget when you run it. 一个Heterodox Visual Studio小工具模板中 ,作者将一个小工具模板放在一起,该模板附带了ac #project,在您运行它时捆绑和部署您的小工具。

Alternatively, you may be interested in the link down the page: Create a Vista Gadget Using Visual Studio IDE 或者,您可能对页面下的链接感兴趣:使用Visual Studio IDE创建Vista小工具

Both involve the use of Visual Studio, which may not be your preferred method of development, but you can get Visual Web Developer Express for free from Microsoft, and I know for fact that the template works in that. 两者都涉及使用Visual Studio,这可能不是您首选的开发方法,但您可以从Microsoft免费获得Visual Web Developer Express,而且我知道该模板的工作原理。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM