让你的程序通过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;

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

 

需要uses comobj

转自:啊D博客(http://blog.d99net.net/article.asp?id=269)

posted @ 2012-10-09 14:33  Handll  阅读(288)  评论(0编辑  收藏  举报