Inno-Setup Semicolon失踪

时间:2016-05-22 20:36:51

标签: inno-setup

我有以下功能导致"分号丢失。"错误",但我不明白为什么。

感谢您的帮助!

 function PrepareToInstall(var NeedsRestart: Boolean): String;
begin
   if not IsServiceRunning('oscmaintenanceserver') then
       begin
           MsgBox('Service not running. Exit.', mbInformation, MB_OK);
           exit;
       end
   end
   if not StopService('oscmaintenanceserver') then
       begin
           MsgBox('Service couldnt be stopped.', mbInformation, MB_OK);
           exit;
       end
   end
   if not RemoveService('oscmaintenanceserver') then
       begin
           MsgBox('Couldnt remove service.', mbInformation, MB_OK);
           exit;
       end
   end   
   begin
       MsgBox('All went fine :-).', mbInformation, MB_OK);
       exit;
   end
end;

1 个答案:

答案 0 :(得分:2)

您在每个if分支中都有额外的end。此外,在标记语句结束时, function PrepareToInstall(var NeedsRestart: Boolean): String; begin if not IsServiceRunning('oscmaintenanceserver') then begin MsgBox('Service not running. Exit.', mbInformation, MB_OK); exit; end; if not StopService('oscmaintenanceserver') then ... 后面需要分号。

{{1}}