views:

58

answers:

1

Hi,

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.

A: 

Taken from: http://www.vincenzo.net/isxkb/index.php?title=Cursor_-_Change_the_mouse_cursor_of_WizardForm

procedure SetControlCursor(control: TWinControl; cursor: TCursor);
var i:Integer;
    wc: TWinControl;
begin
  if (not (control = nil)) then begin
    control.Cursor := cursor;
    try
      for i:=0 to control.ControlCount-1 do begin
        wc := TWinControl(control.Controls[i]);
        if (NOT(wc = nil)) then
          SetControlCursor(wc, cursor)
        else
          control.Controls[i].Cursor := cursor;
      end; {for}
    finally

    end;{try}
  end;{if}
end;{procedure SetControlCursor}

And to set it to the hourglass:

SetControlCursor(WizardForm, crHourGlass);

To set it back to normal:

SetControlCursor(WizardForm, crDefault);
mirtheil
Thank you, the code works like a charm, just a quick note, you can't use it inside InitializeSetup because it will give an error saying: "An attempt was made to access WizardForm before it has been created.", in my case, I just had to move my code to InitializeWizard and that solved the problem.
Vic

related questions