zu14 发表于 2013-1-28 12:40:55

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

<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自带的防火墙 之 综述篇 里,我们提到了下面这两幅图:
http://www.zu14.cn/wp-content/uploads/2009/01/image61.png
http://www.zu14.cn/wp-content/uploads/2009/01/image31.png
这篇,我们实现两个功能: 还原防火墙的默认状态 和 阻止程序时通知
<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>http://www.zu14.cn/wp-content/uploads/2009/01/image10.png
<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);       }
页: [1]
查看完整版本: C#(VB.NET)操作Windows自带的防火墙 之 还原默认设置、阻止程序通知