views:

286

answers:

2

Hi All,

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.

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.

+2  A: 

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 a c# project attached that bundles and deploys your gadget when you run it.

Alternatively, you may be interested in the link down the page: Create a Vista Gadget Using Visual Studio IDE

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.

Toasty Justice
+2  A: 

I do this using a simple batch file that kills sidebar.exe, copies the unzipped gadget files over, and then restarts sidebar.exe. This method also preserves settings between gadget updates.

This is the batch file. You'll have to modify src and dst appropriately. You might have to run it from an elevated command prompt if you haven't disabled 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
Dave76