I would like to know if anyone has a solution to my problem.
I would like to display the thumbnail in the taskbar and at the same time include a checkbox to keep the installer window on top (over other windows) if the checkbox is checked.
If I use the code from the page below to display the installer thumbnail on the taskbar the property "WizardForm.FormStyle" doesn't work.
If anyone can help me, I appreciate it.
Below is a code to better understand my question.
[Setup]
AppName=My App
AppVersion=1.0
DefaultDirName={{#VER > 0x06000000 ? "common" : ""}pf}\My App
DisableWelcomePage=no
OutputBaseFilename=My_App
OutputDir=.
[code]
const
GW_OWNER = 4;
GWL_HWNDPARENT = (-8);
function GetWindowLong(Wnd: HWND; nIndex: Integer): Longint; external 'GetWind...@user32.dll stdcall delayload';
function SetWindowLong(Wnd: HWND; nIndex: Integer; dwNewLong: Longint): Longint; external 'SetWind...@user32.dll stdcall delayload';
function GetWindow(hWnd: HWND; uCmd: UINT): HWND; external 'GetW...@user32.dll stdcall delayload';
var
OnTopCheckBox: TNewCheckBox;
OnTop: Boolean;
////OldParent: Longint;
procedure OnTopCheckBox_OnClick(Sender: TObject);
begin
if OnTopCheckBox.Checked then
begin
////SetWindowLong(WizardForm.Handle, GWL_HWNDPARENT, OldParent);
WizardForm.FormStyle := fsStayOnTop;
end else
begin
WizardForm.FormStyle := fsNormal;
////SetWindowLong(WizardForm.Handle, GWL_HWNDPARENT, GetWindowLong(GetWindow(WizardForm.Handle, GW_OWNER), GWL_HWNDPARENT));
end;
end;
procedure InitializeWizard();
begin
////OldParent := GetWindowLong(WizardForm.Handle, GWL_HWNDPARENT);
OnTopCheckBox := TNewCheckBox.Create(WizardForm);
with OnTopCheckBox do begin
Parent := WizardForm;
Caption := 'Keep On Top';
SetBounds(ScaleX(10), WizardForm.NextButton.Top + ScaleY(2), ScaleX(100), ScaleX(15));
OnClick := @OnTopCheckBox_OnClick;
end;
{ work if disable this line }
SetWindowLong(WizardForm.Handle, GWL_HWNDPARENT, GetWindowLong(GetWindow(WizardForm.Handle, GW_OWNER), GWL_HWNDPARENT));
end;