Windows下用vc ++(msdev)进行编码 [英] Coding in vc++ (msdev) under windows

查看:143
本文介绍了Windows下用vc ++(msdev)进行编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的vb脚本,它删除了允许应用程序通过Windows防火墙的防火墙规则.

This is my vb script that removes a firewall rule that allows an application through the Windows firewall.

Set objFirewall = CreateObject("HNetCfg.FwMgr")
Set objPolicy = objFirewall.LocalPolicy.CurrentProfile

Set colApplications = objPolicy.AuthorizedApplications

errReturn = colApplications.Remove("c:\windows\system32\freecell.exe")




我想知道如何使用vc ++(msdev)代码实现等效功能.

我不知道要使用c ++实例化COM对象

我知道我想使用COM ..

请帮助老年人




I want to know how to implement the equivalent with vc++(msdev) code.

I don''t know to instantiate a COM object with c++

I know i want to use COM..

pls help seniors

推荐答案



看一下MSDN文章:使用C ++行使防火墙 [
Hi,

Have a look at the MSDN article: Exercising the Firewall using C++[^]

The VB script sample you posted appears to be removing a firewall application rule. If you wanted to do this under COM with C++ you would need modify the line in the sample function WindowsFirewallAddApp:

hr = fwApps->Add(fwApp);



并将其更改为:



And change it to:

hr = fwApps->Remove(fwApp);



不要忘记将函数重命名为WindowsFirewall Remove App之类的东西,否则它将使将来的项目维护人员发疯. :)

最好的祝福,
-大卫·德劳恩(David Delaune)



Don''t forget to rename the function to something like WindowsFirewallRemoveApp or it will drive a future project maintainer crazy. :)

Best Wishes,
-David Delaune


这篇关于Windows下用vc ++(msdev)进行编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆