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

推荐订阅源

WordPress大学
WordPress大学
Spread Privacy
Spread Privacy
T
The Exploit Database - CXSecurity.com
Simon Willison's Weblog
Simon Willison's Weblog
P
Privacy & Cybersecurity Law Blog
L
LINUX DO - 热门话题
T
Threat Research - Cisco Blogs
T
Tenable Blog
TaoSecurity Blog
TaoSecurity Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
AI
AI
P
Proofpoint News Feed
A
About on SuperTechFans
P
Privacy International News Feed
月光博客
月光博客
雷峰网
雷峰网
S
Secure Thoughts
博客园 - 叶小钗
博客园 - 聂微东
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Project Zero
Project Zero
The Cloudflare Blog
SecWiki News
SecWiki News
The Hacker News
The Hacker News
V
Vulnerabilities – Threatpost
罗磊的独立博客
A
Arctic Wolf
阮一峰的网络日志
阮一峰的网络日志
Know Your Adversary
Know Your Adversary
酷 壳 – CoolShell
酷 壳 – CoolShell
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
T
Troy Hunt's Blog
The Last Watchdog
The Last Watchdog
Schneier on Security
Schneier on Security
小众软件
小众软件
有赞技术团队
有赞技术团队
博客园 - 司徒正美
T
Tailwind CSS Blog
量子位
C
Cybersecurity and Infrastructure Security Agency CISA
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Hugging Face - Blog
Hugging Face - Blog
人人都是产品经理
人人都是产品经理
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
S
Security @ Cisco Blogs
大猫的无限游戏
大猫的无限游戏
S
SegmentFault 最新的问题
Apple Machine Learning Research
Apple Machine Learning Research
宝玉的分享
宝玉的分享
L
Lohrmann on Cybersecurity

博客园 - 锐

Windows7 Server 2008 下安装Oracle 10g提示“程序异常终止,发生未知错误”的解决方法 Android应用自动更新功能的代码实现 Undefined exploded archive location 项目不能部署 linux下mysql5.5.19编译安装笔记【已验证】 CSS+DIV排版时容器内对象全部设置了float属性后容器不能自动适应高度的解决方案 php Smarty模板生成html文档的方法 - 锐 - 博客园 如何解决Firefox检测不到div高度问题 DD_belatedPNG,解决IE6不支持PNG绝佳方案 .net程序运行在无.net framework环境中 struts2 freemarker当中引进java 常量java静态方法 - 锐 简体-繁体互转换的一个JS - 锐 - 博客园 Tencent://Message/协议的实现原理 - 锐 - 博客园 国内三大免费流媒体WAP门户网站(视频类WAP网站) C#中RSA加密解密和签名与验证的实现 (转) C#读取CPUid,硬盘id,网卡Mac地址 Struts2.1.6使用小技巧 java -D参数简化加入多个jar MySQL Proxy 学习笔记(转) 用apache ab做web压力测试
C#实现通过URL触发自己的程序
· 2010-07-15 · via 博客园 - 锐

实现原理:http://hi.baidu.com/wu1987116/blog/item/8352896056ea254deaf8f83e.html

本例功能:在IE访问baidu:内容时,将baidu:内容做为启动参数,执行ceshi.exe程序,在程序中将内容作为搜索

                内容,执行百度搜索

实现步骤:

在VS2005中新建Windows应用程序

在Program.cs文件的中的static void Main()

方法中加入代码:

static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            if (System.Environment.GetCommandLineArgs().Length > 1)             //如果有启动参数
            {
                string strCmd = System.Environment.GetCommandLineArgs()[1].ToLower();
                string startCmd = "http://www.baidu.com/s?wd=" + strCmd.Replace("baidu:", "");
                System.Diagnostics.Process.Start(startCmd);
            }
            else
            {
                MessageBox.Show("参数错误!", "提示");
            }
        }

生成exe文件

导入如下注册表信息:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\baidu]
@=""
"URL Protocol"=""

[HKEY_CLASSES_ROOT\baidu\Shell]

[HKEY_CLASSES_ROOT\baidu\Shell\Open]

[HKEY_CLASSES_ROOT\baidu\Shell\Open\Command]
@="D:\\ceshi.exe %1"

"D:\\ceshi.exe %1"    为生成的程序路径,

此注册表所实现的就是当浏览器(或其它)碰到 baidu:… 时,自动调用 ceshi.exe,并把 baidu:… 地址作为参数传递给 ceshi.exe,并通过ceshi.exe判断传入的参数格式,执行操作