本文整理自网络,侵删。
procedure Set_WindowsXP_FireWall(Enable: boolean);
// 需引用 winsvc, shellapi
// Set_WindowsXP_FireWall(false); // ?P?] Windows Xp 防火?? www.delphitop.com
//
var
SCM, hService: LongWord;
sStatus: TServiceStatus;
begin
if Enable = false then
begin
SCM := OpenSCManager(nil, nil, SC_MANAGER_ALL_ACCESS);
hService := OpenService(SCM, PChar('SharedAccess'), SERVICE_ALL_ACCESS);
ControlService(hService, SERVICE_CONTROL_STOP, sStatus);
CloseServiceHandle(hService);
end;
相关阅读 >>
解决 Delphi 程序在不同操作系统中 shellexecute 调用 chrome.exe 偶尔无效的问题
Delphi combobox 只读 text属性可用的方法
Delphi里参数修饰符const、var、out的作用分别是什么?
更多相关阅读请进入《Delphi》频道 >>