Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Uses WinSvc;
procedure TForm1.Button1Click(Sender: TObject);
var sc_h, sc_man : SC_HANDLE;
begin
sc_man := OpenSCManager(nil, nil, SERVICE_START);
if sc_man = 0 then
ShowMessage('OpenSCManager' + SysErrorMessage(GetLastError))
else begin
sc_h := OpenService(sc_man, 'W3SVC', SERVICE_START);
if sc_h = 0 then
ShowMessage('OpenSevice: ' + SysErrorMessage(GetLastError))
else begin
StartService(sc_h, 0, PChar(nil^));
CloseServiceHandle(sc_h);
end;
CloseServiceHandle(sc_man);
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
var sc_h, sc_man : SC_HANDLE;
sstat: TServiceStatus;
begin
sc_man := OpenSCManager(nil, nil, SERVICE_START);
if sc_man = 0 then
ShowMessage('OpenSCManager' + SysErrorMessage(GetLastError))
else begin
sc_h := OpenService(sc_man, 'W3SVC', SERVICE_STOP);
if sc_h = 0 then
ShowMessage('OpenSevice: ' + SysErrorMessage(GetLastError))
else begin
ControlService(sc_h, SERVICE_CONTROL_STOP, sstat);
CloseServiceHandle(sc_h);
end;
CloseServiceHandle(sc_man);
end;
end;