The following script shows how to start an application without waiting for its execution to be finished and immediately after the application is started show a message box for 5 seconds. For this you will need to use the nowait
flag for the [Run]
section entry, have an AfterInstall
function, and a message dialog which is able to close itself after a time period (I have used the one from this post
).
The principle is easy; when the [Run]
section entry with your application is processed, the application is started and thanks to nowait
flag, the entry is taken as processed immediately after the app starts. And since the AfterInstall
trigger function is called when the entry is processed, we can show that message dialog from its assigned function:
[Files]
Source: "MyProg.exe"; DestDir: "{app}"
[Run]
Filename: "{app}\MyProg.exe"; AfterInstall: ShowStartingMessageBox; Flags: nowait
[Code]
#ifdef UNICODE
#define AW "W"
#else
#define AW "A"
#endif
const
MB_ICONINFORMATION = $40;
function MessageBoxTimeout(hWnd: HWND; lpText: string; lpCaption: string;
uType: UINT; wLanguageId: Word; dwMilliseconds: DWORD): Integer;
external 'MessageBoxTimeout{#AW}@user32.dll stdcall';
procedure ShowStartingMessageBox;
begin
MessageBoxTimeout(WizardForm.Handle, 'The application is starting... ' +
'Ok, to be upright; it''s been started, but since its initialization ' +
'takes a long time, we usually say it''s starting. This message will ' +
'be automatically closed in 5 seconds!', 'Caption...',
MB_OK or MB_ICONINFORMATION, 0, 5000);
end;