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;
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;
本文将指导您如何使用Delphi编程语言通过创建OLE对象来配置防火墙规则,以允许特定程序通过。
961

被折叠的 条评论
为什么被折叠?



