使用 ShellExecute 的一些技巧
2008-12-02 08:47
417 查看
确定默认的 Web 浏览器
loadTOCNode(2, 'moreinformation');by default,Microsoft Internet Explorer checks to see if is default Web browser that starts each time。 if when Internet Explorer starts Internet document (HTML) files are associated with different browser,Internet Explorer recognizes that is not default browser and then prompts to make default browser。
当您选择 使其默认的浏览器 在 Internet Explorer 中及更高版本的 Netscape 中时, 在浏览器注册本身到 所有 以下项将自身设置为默认浏览器 (在编写的其他项)。
HKEY_CLASSES_ROOT/.htm
HKEY_CLASSES_ROOT/.html
HKEY_CLASSES_ROOT/http/shell/open/command
HKEY_CLASSES_ROOT/http/shell/open/ddeexec/Application
HKEY_CLASSES_ROOT/ftp/shell/open/command
HKEY_CLASSES_ROOT/ftp/shell/open/ddeexec/Application
HKEY_CLASSES_ROOT/gopher/shell/open/command
HKEY_CLASSES_ROOT/gopher/shell/open/ddeexec/Application
从您的应用程序启动默认 Web 浏览器
loadTOCNode(2, 'moreinformation');
调用 ShellExecute API 并将它传递一个 URL。 它是要从您的应用程序启动默认的 Web 浏览器最简便的方式。 如果默认的 Web 浏览器当前运行, ShellExecute 告诉运行要转到您的统一资源定位符 (URL) 的实例。 如果它没有运行, ShellExecute 启动应用程序,然后浏览到您的 URL。
ShellExecute 原理
loadTOCNode(2, 'moreinformation');下面的背景是仅以提供信息为目的。 它提供,以便您可以更好地了解您的应用程序如何与操作系统交互。 不基于您的设计方案假设您从此信息中绘制的。 一定要注意此功能可能会在未来版本 Microsoft 产品的更改。
ShellExecute 如何解释 URL 传递
loadTOCNode(3, 'moreinformation');ShellExecute parses that is passed to that so ShellExecute can extract either protocol specifier or extension string。 next, ShellExecute in registry looks and then to determine which application to start uses either protocol specifier or extension。 if to ShellExecute pass http://www.microsoft.com , ShellExecute recognizes protocol,which causes ShellExecute to view HKEY_CLASSES_ROOT/http/shell/open for information about how to run as http:// sub-string。 如果您将 myfile.htm 传递到 ShellExecute , ShellExecute 识别作为扩展".htm"子。 这将导致 ShellExecute ,以查看 HKEY_CLASSES_ROOT/.htm,这会导致 HKEY_CLASSES_ROOT/htmlfile/shell/open。
通常,则最好完全例如传递到 ShellExecute ,在字符串中指定您的 URL: http://www.microsoft.com ,而不是 www.microsoft.com 。 当您完全指定 URL 时, 您以确保 ShellExecute 知道所需完全的协议。 by default,however, ShellExecute detects some patterns that include www.* and ftp.* ,and then maps those patterns respectively to Hypertext Transfer Protocol (HTTP) protocol and File Transfer Protocol (FTP)。
ShellExecute 如何确定是否启动一个新实例
loadTOCNode(3, 'moreinformation');ShellExecute 查找通过注册表时,它将查找该 shell/open 子项。 如果定义 shell/open/ddeexec 键,然后在动态数据交换 (DDE) 消息与指定的应用程序 IExplore 和 WWW_OpenURL 广播到所有顶级窗口在桌面上主题。 第一个应用程序来响应此消息是应用程序,转到所请求的 URL。 如果没有应用程序响应此 DDE 消息,然后 ShellExecute 使用 shell/open/command 子项,以启动该应用程序中包含的信息。 它然后 re-broadcasts DDE 消息转到所请求的 URL。
引自: http://support.microsoft.com/kb/224816/zh-cn
相关文章推荐
- liunx初学一些基础的命令使用技巧
- RTF域在b/s下的一些使用技巧
- Asp.Net实现FORM认证的一些使用技巧(必看篇)
- rdesktop远程使用Windows的一些技巧
- PLSQL DEVELOPER 使用的一些技巧
- web页面的一些使用技巧
- java 关于使用java1.8的localDateTime日期操作的基本使用以及一些使用技巧 持续更新...
- Jasperreport的一些使用技巧
- typedef使用的一些技巧
- CodeBlock一些使用技巧
- 一些Spring MVC的使用技巧
- INFORMIX-SQL的一些使用技巧
- pandas使用的一些技巧
- Vim的一些使用技巧
- 使用python 爬虫抓站的一些技巧总结
- 使用Linux五年积累的一些经验技巧
- PLSQL DEVELOPER 使用的一些技巧【转】
- Castle ActiveRecord学习实践(9):使用ActiveRecord的一些技巧
- 关于使用ASP.NET2.0中GridView控件的一些技巧。
- Android Studio的一些技巧和使用注意事项(持续更新)