在Inno啓動我的應用程序後,我希望Inno安裝2個服務,並在Windows服務列表中安裝文件夾的屬性。Inno安裝程序編譯器:如何安裝服務
我已經安裝了wamp
,我想爲apache
和new service for
mysql`添加新的服務
apacheServiceInstallParams = -n wampapachec -k install
mysqlServiceInstallParams = --install-manual wampmysqldc
function InstallService(const FileName, ServiceName,
DisplayName: string; ServiceType, StartType: DWORD): Boolean;
var
ManagerHandle: SC_HANDLE;
ServiceHandle: SC_HANDLE;
begin
Result := False;
ManagerHandle := OpenSCManager('', '', SC_MANAGER_ALL_ACCESS);
if ManagerHandle <> 0 then
begin
try
ServiceHandle := CreateService(ManagerHandle, ServiceName,
DisplayName, SERVICE_ALL_ACCESS, ServiceType, StartType,
SERVICE_ERROR_IGNORE, FileName, '', 0, '', '', '');
if ServiceHandle <> 0 then
begin
Result := True;
CloseServiceHandle(ServiceHandle);
end
else
MsgBox(SysErrorMessage(DLLGetLastError), mbError, MB_OK);
finally
CloseServiceHandle(ManagerHandle);
end;
end
else
MsgBox(SysErrorMessage(DLLGetLastError), mbError, MB_OK);
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssPostInstall then
begin
if InstallService(ExpandConstant('{app}\bin\aoache\apache2.2.22\bin\httpd.exe'),
'wampapachecow',
'MySQL', SERVICE_WIN32_SHARE_PROCESS, SERVICE_AUTO_START)
then
MsgBox('MySql Service installation succeeded!', mbInformation, MB_OK);
if InstallService(ExpandConstant('{app}\bin\mysql\mysql5.5.24\bin\mysqld.exe'),
'wampmysqldcow',
'MySQL', SERVICE_WIN32_SHARE_PROCESS, SERVICE_AUTO_START)
then
MsgBox('MySql Service installation succeeded!', mbInformation, MB_OK);
end;
end;
什麼,我不明白:
我有這樣的:
InstallService(ExpandConstant('{app}\bin\aoache\apache2.2.22\bin\httpd.exe'),
'wampapachecow',
'MySQL', SERVICE_WIN32_SHARE_PROCESS, SERVICE_AUTO_START)
它應該是這樣的嗎?
InstallService(ExpandConstant('{app}\MySQL 5.5\bin\mysqld.exe'),
ExpandConstant('--defaults-file="{app}\MySQL 5.5\my.ini"'),
'MySQL', SERVICE_WIN32_SHARE_PROCESS, SERVICE_AUTO_START)
請解釋的第二個參數:
'wampapachecow'
和ExpandConstant('--defaults-file="{app}\MySQL 5.5\my.ini"')
我需要查看原始代碼。或者,我會發布一系列關於如何安裝,控制和卸載服務的問答。 [我現在忙着去做...] – TLama