您现在的位置:首页 >> 硬件系统 >> 硬件系统 >> 内容

Delphi让你的程序通过XP防火墙

时间:2011/9/3 15:18:46 点击:

  核心提示:procedureTForm1.Button1Click(Sender:TObject);varFwMgr,Profile,FwApp:variant;beginFwMgr:=CreateOLEObj...
procedure TForm1.Button1Click(Sender: TObject);
var
  FwMgr,Profile,FwApp: variant;
begin
  FwMgr := CreateOLEObject('HNetCfg.FwMgr');
  Profile := FwMgr.LocalPolicy.CurrentProfile;
  FwApp := CreateOLEObject('HNetCfg.FwAuthorizedApplication');
  FwApp.Name :='我的测试'; //显示名字
  FwApp.ProcessImageFileName := Application.ExeName; //要通过的程序
  FwApp.Enabled  := true;
  Profile.AuthorizedApplications.Add(FwApp);
end;

这样,你的软件就能通过XP的防火墙了,不会再有拦截提示了!

作者:d99 来源:转载
共有评论 0相关评论
发表我的评论
  • 大名:
  • 内容:
  • 盒子文章(www.2ccc.com) © 2024 版权所有 All Rights Reserved.
  • 沪ICP备05001939号