让你的程序通过XP防火墙

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;

  

posted @ 2016-03-31 13:58  今心  阅读(261)  评论(0编辑  收藏  举报