惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Cisco Talos Blog
Cisco Talos Blog
阮一峰的网络日志
阮一峰的网络日志
云风的 BLOG
云风的 BLOG
D
Docker
Vercel News
Vercel News
IT之家
IT之家
Recent Announcements
Recent Announcements
Last Week in AI
Last Week in AI
V
Visual Studio Blog
Engineering at Meta
Engineering at Meta
腾讯CDC
Google DeepMind News
Google DeepMind News
I
InfoQ
博客园 - 三生石上(FineUI控件)
Apple Machine Learning Research
Apple Machine Learning Research
The GitHub Blog
The GitHub Blog
博客园 - Franky
The Cloudflare Blog
A
About on SuperTechFans
有赞技术团队
有赞技术团队
Y
Y Combinator Blog
T
Tenable Blog
P
Proofpoint News Feed
Recorded Future
Recorded Future
Security Latest
Security Latest
H
Hackread – Cybersecurity News, Data Breaches, AI and More
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
博客园 - 聂微东
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Google Online Security Blog
Google Online Security Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Simon Willison's Weblog
Simon Willison's Weblog
The Last Watchdog
The Last Watchdog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
N
News and Events Feed by Topic
TaoSecurity Blog
TaoSecurity Blog
U
Unit 42
The Hacker News
The Hacker News
Martin Fowler
Martin Fowler
T
Threat Research - Cisco Blogs
NISL@THU
NISL@THU
F
Full Disclosure
M
MIT News - Artificial intelligence
人人都是产品经理
人人都是产品经理
Hugging Face - Blog
Hugging Face - Blog
V
V2EX
Project Zero
Project Zero

博客园 - 有些伤感

another year Good luck to my little brother Happy birthday to me Bye Bye Bye 近来的几件事 《猜火车》(Trainspotting)-- What is you choise 猫,狗及其它 《剪刀手爱德华》(Edward Scissorhands )-- I can't Web开发难题暨解决方法研讨会 《杀出个黎明》(From Dusk Till Dawn)--This is the fucking movie 《末路狂花》(Thelma & Louise)-- Be sweet to your wife WebService异常 代友招人 每个人都有自己的困扰 IBM SOA解决方案 WPF/WPFE笔记(一):准备工作 祝大家新年快乐 项目快完了 最近我在做什么?
在网页上启动你的应用程序
有些伤感 · 2007-06-25 · via 博客园 - 有些伤感

现在有一些程序是B/S和C/S混合的,在winform里也可以方便的嵌入web,vs2003和vs2005都提供了这样的控件。
而还有一种需求,在web上启动你的winform程序,比较常见的是qq,下载工具等。

笨一点的做法,是通过客户端js来启动。这样做有安全隐患,因此window后面版本的操作系统,严格限制了js的权限。

研究qq的实现方式,发现非常简单。看下面的注册文件:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Test]
@="Test"
"URL Protocol"="应用程序路径%l"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Test\DefaultIcon]
@="%SystemRoot%\\system32\\url.dll,0"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Test\Shell]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Test\Shell\open]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Test\Shell\open\command]
@="应用程序路径 %l"

你可以直接将它保存为一个reg文件然后注册,或者在你的应用程序安装时直接修改注册表。

在你的网页上加一个这样的链接:
<A href='Test://para1&para2&para3'>

如果你点这个链接,你在注册文件里的应用程序就可以被启动了。

还有一个需求,一般从网页启动应用需要传递参数(上面链接后面带了三个参数),做法如下:

你的应用程序主函数要这样接收参数:

static void Main(string[]   args)
  {
   if(args.Length>0)
   {
    //存参数
    }
  }
通过args[index]就可以访问到你传递的参数了。