When we run an installer, sometimes the control switches between your installer and other application's screen, which might shift the focus from the installer dialog.
Here is how you can make sure to stay on top of your installer dialog unless you swtich explictly.
Call the function - SetInstallerDlgFocus(), before invoking each dialog, so that your installer will be always available in the foreground.
// Included header files
#include "WinApi.h" // Required to Make Win32 API Calls
// Function declaration
prototype SetInstallerDlgFocus();
// Function definition
///////////////////////////////////////////////////////////////////////////////
// FUNCTION: SetInstallerDlgFocus
// Purpose: Bring window to the foreground.
///////////////////////////////////////////////////////////////////////////////
function SetInstallerDlgFocus()
HWND hDialog;
begin
hDialog = GetWindowHandle(HWND_INSTALL);
SetForegroundWindow(hDialog);
end; // end of SetInstallerDlgFocus
[Note: This applies to InstallScript MSI and Pure InstallScript type projects.]
No comments:
Post a Comment