六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 30|回复: 0

C#(VB.NET)操作Windows自带的防火墙 之 还原默认设置、阻止程序通知

[复制链接]

升级  58.4%

256

主题

256

主题

256

主题

进士

Rank: 4

积分
792
 楼主| 发表于 2013-1-28 12:40:55 | 显示全部楼层 |阅读模式
<script type="text/javascript"><!--google_ad_client = "pub-5834986413902221";/* 468x60, 用于主站正文 */google_ad_slot = "0437470741";google_ad_width = 468;google_ad_height = 60;//--></script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>在 C#(VB.NET)操作Windows自带的防火墙 之 综述篇 里,我们提到了下面这两幅图:


这篇,我们实现两个功能: 还原防火墙的默认状态阻止程序时通知
<script type="text/javascript"><!--google_ad_client = "pub-5834986413902221";/* 336x280, 创建于 09-1-11 */google_ad_slot = "3738213453";google_ad_width = 336;google_ad_height = 280;//--></script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<div class="wp_codebox" style="padding-bottom: 15px;">      void Button1Click(object sender, EventArgs e)       {           //获取管理防火墙的COM组件的type           Type fwMgrType = Type.GetTypeFromProgID("HNetCfg.FwMgr", true);           //创建一个COM组件的实例           object fwMgr = Activator.CreateInstance(fwMgrType);                      //调用 RestoreDefaults() 恢复默认值           fwMgrType.InvokeMember("RestoreDefaults", BindingFlags.InvokeMethod, null, fwMgr, null);       }
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表