Code to run after all files are installed

北战南征 提交于 2019-12-23 02:52:55

问题


I got the following little function which I need to call after all files of the [Files] section have been copied

procedure DllAfterInstall(platform: Integer);
begin
    if not installDriver(platform) then
                MsgBox(ExpandConstant('{cm:installDriverFail}'), mbError, MB_OK);
end;

where installDriver(platform) is an external function to one of my dll's.

As soon as I try to call the DllAfterInstall function in the [Run] section like

Filename: "{code:DllAfterInstall}"; Parameters: 0; Check: not IsWin64

I got the error

Invalid prototype for 'DllAfterInstall'

So can anyone tell me what I'm doing wrong? Or maybe is there another way to call a *.dll after all files have been copied? The *.dll function should only be called once so AfterInstall is no option.


回答1:


Call your code from CurStepChanged event function when CurStep is ssPostInstall:

procedure CurStepChanged(CurStep: TSetupStep);
begin
  if CurStep = ssPostInstall then
  begin
    Log('Post install');
    DllAfterInstall(platform);
  end;
end;

You also need to provide an actual value to the platform parameter of the function.



来源:https://stackoverflow.com/questions/32777470/code-to-run-after-all-files-are-installed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!