本文整理自网络,侵删。
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的防火墙了,不会再有拦截提示了!
相关阅读 >>
print documents from Delphi - print pdf, doc, xls, html, rtf, docx, txt
Delphi 使用 inputbox、inputquery 的启发
更多相关阅读请进入《Delphi》频道 >>