原文地址:http://msdn.microsoft.com/en-us/library/bb456467(VS.85).aspx

This overview describes the various methods and techniques that can be used to debug gadgets.

  • Debugging a Missing Gadget
  • Debugging Code
  • Debuggers
  • Tips
    • Character Encoding
    • Fonts

Debugging a Missing Gadget

If a gadget fails to appear in the Gadget picker, the likely culprit is an invalid or malformed gadget.xml manifest file. Open the manifest file with Windows Internet Explorer or other XML editor to check.

If a gadget appears in the Gadget picker but is displayed with the Sidebar's generic gadget image, ensure that the desired image exists in the gadget file structure and that the path to the image file in the manifest is correct.

Copy Code

<hosts><host name="sidebar"><base type="HTML" apiVersion="1.0.0" src="sample.html" /><permissions>Full</permissions><platform minPlatformVersion="1.0" /><defaultImage src="icon.png" /></host>
</hosts>

This procedure may require repeating if either the gadget drag-and-drop image or the developer's logo is missing or broken.

Copy Code

<author name="Microsoft"><info url="msdn.microsoft.com" /><logo src="logo.png" />
</author>
...
<icons>
<icon height="48" width="48" src="icon.png" />
</icons>

Debugging Code

Depending on the complexity of the gadget code, debugging can consist simply of dumping information to the gadget user interface (UI) (similar to simple Web applications) at specific code points or by catching exceptions with a try...catch block. Microsoft JScript alerts are often used for quick and dirty debugging, but these are not implemented in the Sidebar. If necessary, this limitation can be worked around by using the equivalent Microsoft Visual Basic Scripting Edition (VBScript) MsgBox function.

If the complexity of your gadget code requires a more robust debugging solution then a number of script debuggers are available.

Debuggers

Any script debugger can be used to debug a gadget, including Microsoft Script Debugger, Microsoft Script Editor, and Microsoft Visual Studio. Enabling gadget debugging requires a minor tweak to the Internet Explorer settings:

From the menu, click Tools and select Internet Options.

Click the Advanced tab and verify that both Disable script debugging check boxes are not selected.

If using Visual Studio for debugging, click Tools, select Options, and ensure that Just-In-Time debugging is enabled for Script:

To dump specific output to the debugger console, the outputString method can be used:

Copy Code

// --------------------------------------------------------------------
// Attempt to save the file and throw an error if the filename does
// not include a file extension.
// --------------------------------------------------------------------
function SaveFile()
{var fso = new ActiveXObject( "Scripting.FileSystemObject" );// Throw an arbitrary error to demonstrate the outputString method.try{if (sFilename.indexOf(".") == -1){            throw "'Filename' does not specify a file extension.";}var file = fso.OpenTextFile(sFilePath + sFilename, FOR_WRITING, CREATE_NEW);file.Write(sContent);file.Close();fso = file = null;}catch(e){System.Debug.outputString(e);}
}

To break into the gadget runtime at a particular execution point and step through the code, you can place this line of code where necessary:

Copy Code

debugger;

When the debugger statement is executed the Visual Studio Just-In-Time Debugger dialog will prompt you to open a registered debugger:

Once a debugger is selected, the code will be displayed in the debugger with the break point highlighted. From this point you can step through the code and get runtime information for any gadget element:

Tips

Character Encoding

It is highly recommended that all gadget HTML and script files be saved with UTF-8 character encoding.

The following steps can be taken to ensure the encoding of these files:

  1. Open the file in Notepad.
  2. On the File menu, click Save as...
  3. In the Save as dialog box, confirm that the value in the Encoding drop-down is UTF-8.

If the value in the Encoding drop-down is not UTF-8:

  1. In the Encoding drop-down, select UTF-8.
  2. Click Save to overwrite the existing file.

Repeat this process for all gadget HTML and script files.

注意:

1. 调试的文件地址 C:\Users\用户名\AppData\Local\Microsoft\Windows Sidebar\Gadgets

2. 设置IE后,重启IE,调试。

转载于:https://www.cnblogs.com/doubleyan/archive/2009/07/12/2165027.html

Gadgets 侧边栏小工具 跟踪调试方法相关推荐

  1. 微信小程序开发系列教程三:微信小程序的调试方法

    微信小程序开发系列教程 微信小程序开发系列一:微信小程序的申请和开发环境的搭建 微信小程序开发系列二:微信小程序的视图设计 这个教程的前两篇文章,介绍了如何用下图所示的微信开发者工具自动生成一个Hel ...

  2. shell脚本——grep cut sort uniq tee diff paster tr等小工具的使用方法

    shell脚本的一些小工具的使用方法 grep 语法和选项 实例 cut 语法和选项 实例 sort 语法和选项 实例 uniq 语法和选项 实例 tee 语法和选项 实例 diff 语法和选项 实例 ...

  3. 迷笛音乐学校 如何_适用于音乐迷的炫酷Vista侧边栏小工具

    迷笛音乐学校 如何 Personally I have never been a huge fan of the default gadgets in Windows Vista.  Since Vi ...

  4. php源代码压缩,PHP_PHP 源代码压缩小工具,使用方法:(在命令行运行) 复 - phpStudy...

    PHP 源代码压缩小工具 使用方法:(在命令行运行) 复制代码 代码如下: php compactor.php DESTINATION.php SOURCE.php 下载: compactor.php ...

  5. C# webservice服务跟踪调试方法(转)

    1.新建网站,添加服务,并创建服务. 2.打开internet 信息服务管理器,添加网站,映射到创建的服务所在网站的目录. 3.打开服务所在网站的解决方案,进行配置. 1) 设置启动选项 选择启动操作 ...

  6. 【转载】ubuntu下linux内核源码阅读工具和调试方法总结

    http://blog.chinaunix.net/space.php?uid=20940095&do=blog&cuid=2377369 一 linux内核源码阅读工具 window ...

  7. wordpress后台外观没有菜单和小工具的解决方法

    进入wordpress后台,打开functions.php这个模板 在里面加入这段代码: if ( function_exists('register_sidebar') )register_side ...

  8. WordPress添加侧栏小工具-博客统计(网站统计)

    WordPress侧边栏"博客统计"小工具的制作方法.首先要下载cztcms.zip文件,解压得到一个PHP文件.蓝奏云地址:▶ cztcms.zip 1.将这个PHP文件放到主题 ...

  9. WordPress 开发带缩略图随机文章小工具

    以前曾经分享了一篇 给WordPress后台小工具增加一个随机文章,但没有附加缩略图的功能,为了让你的随机文章看起来更吸睛,这里加上特色图像的缩略图,效果如本站左边栏的随机文章,步骤和代码如下: 后台 ...

  10. WordPress 开发带缩略图的小工具最新文章

    在我们的wordpress边栏想显示我们发布的最新文章,并且带上缩略图,很多插件能帮我们完成这个功能,其实我们完全可以自己DIY,和wordpress原生态的小工具一样,直接拖过去就OK了,这里把流程 ...

最新文章

  1. 23个 Git 最常用命令速查手册,值得收藏!
  2. jspServlet(2)
  3. P4331-[BalticOI2004]Sequence数字序列【左偏树】
  4. 微服务架构案例(06):通过业务、应用、技术、存储方面,聊聊架构
  5. 从读写角度,带你了解数仓的IO基本框架
  6. 排序-概述,插入排序(180602更新完毕)
  7. PyTorch 成程序员“新宠”,TensorFlow 风光不再?
  8. fastjson maven依赖_Spring Boot 使用 Maven 定制一个 parent 简化开发
  9. excel游戏_Excel集中游戏
  10. 2018年sfdc工作总结_Lightning公用组件_模糊搜索单选组件
  11. 微软流媒体服务器直播,流媒体服务器Flussonic Media Server对直播流进行录制
  12. 嵌入式linux培训教程,嵌入式Linux开发学习之Linux文件系统学习
  13. Zepeto正加速摆脱“捏脸”应用的传统印象,成为亚洲最大虚拟世界平台
  14. Python从入门到实践第9章课后作业
  15. 无鸭不过秋,这样吃鸭润燥解乏!
  16. 图像紫边消除(depurple)
  17. Web安全之SQL注入漏洞学习(一)
  18. 四大Linux备份工具比较与操作实例
  19. 9.17 hive高级语法01
  20. Mac连接网线能够接收微信消息,浏览器不能访问网页

热门文章

  1. Oracle12c操作命令
  2. Subversion for Windows 相关工具
  3. AjaxControlToolkit的CalendarExtender的本地化
  4. 论文:GeoGebra 在线数学应用函数演示
  5. Redis基础、应用场景、数据结构及案例
  6. 无法打开登录所请求的数据库 xxxx。登录失败。 用户 'NT AUTHORITY\SYSTEM' 登录失败。...
  7. Liferay7 BPM门户开发之38: OSGi模块化Bndtools、Maven、Gradle开发构建入门
  8. NFS网络文件系统配置
  9. jQuery使table表格隔行显示不同颜色
  10. struts2第一个程序的详解(配图)