Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change mouse cursor inside Inno setup?

I created a setup using Inno installer, during the setup, I made some lengthly operations to check certain values over the system (registry keys, some files...) and during that time no interface is displayed to the user, I do all of this inside InitializeSetup function.

What I would like to know is if I can change the mouse pointer while I'm doing all of those checks, so the user knows that something is happening.

I think I can create a dll and call from inno the functions inside the dll that change the cursor, but I don't want to make a separate dll, I was wandering if there is a way to do it just using pascal scripting.

Thanks for the help.

like image 698
Vic Avatar asked Dec 16 '22 22:12

Vic


1 Answers

Maybe something changed in recent versions of Inno Setup but I could not get the answer from Mirtheil to work.

Instead I figured out this one:

procedure SetControlCursor(oCtrl: TControl; oCurs: TCursor);
var 
  i     : Integer;
  oCmp  : TComponent;
begin
  oCtrl.Cursor := oCurs;
  for i := 0 to oCtrl.ComponentCount-1 do
  begin
    oCmp := oCtrl.Components[i];
    if oCmp is TControl then
    begin
      SetControlCursor(TControl(oCmp), oCurs);
    end;
  end;
end;

Set an hourglass cursor:

SetControlCursor(WizardForm, crHourGlass);    

Reset the hourglass cursor:

SetControlCursor(WizardForm, crDefault);  

Hope this helps someone!

like image 68
Sirp Avatar answered Jan 19 '23 05:01

Sirp