How execute code before which the Inno Select language dialog is shown - inno-setup

I need to execute a pascal code before that the Select Setup language Dialog is shown , unfortunately the InitializeSetup event is executed after.
function InitializeSetup(): Boolean; //This event occurs to late
begin
DoSomething();
Result := True;
end;
So it's possible execute a script code before of the Select Setup language Dialog is shown?

I had similar problem, and I thought about different workarounds: style all setup manually, or make inner localization, but they all looked so doomed from the beginning.
Select Setup language Dialog
I have forked issrc, built it locally, and looked at the main.pas of the Setup project. I see the idea behind doing as it is now : people may wanna use {Language} in InitializeSetup, so its called after the AskForLanguage method.
To just check the idea I made small changes to main.pas: call AskForLanguage after CodeRunner inited and InitializeSetup called. I got VCL'ed Select Setup Language dialog, but not all - NON Client Area wasnt VCL'ed:
I've tried to inherit the language form not from the TForm class but from the TSetupForm, or call it in the middle of setup or make other changes - with no result. If anybody know why it's not VCL'ed - tell me please!
Then I read the Custom Window Frame Using DWM article and just made the form border bsNone and got this:
So for now I'm fine with it. That form not styled before many pages of styled setup was so... annoying.
If we wanna do it a right way, I guess all that needs to be done - is moving CodeRunner init before AskForLanguage, and add a custom code function like StyleInit or so. Then all will be happy: {Language} will be available in InitializeSetup and Dialog will be VCL'ed.

No, the function InitializeSetup() is called as first.
All other functions are called later.
Of course you can modify Inno's sources and add custom functions but I think it is not your case.
Why do you need this? Maybe there is solution which can solve your situation, please tell us details.

Another possible solution is using Inno setup Ultra, it has several inprovements, and InitializeLanguageDialog function is one of them. just load style in it. (Also you can freely change language dialog itself that is so nice).

Related

Can I show the custom window before all the wizard pages in Inno Setup?

I export a function from dll like this:
function IsClientLaunched : Boolean;
external 'IsClientStarted#files:IsStart.dll stdcall setuponly';
I need this function to check if my application is already running or not. It returns True if it's running and false if it's not.
What I need to do is depending on the result of that function I have to show the custom window with the custom message and 2 buttons: Continue and Cancel. So if I close the app and press Continue then the installation process goes on. If I press Cancel then the installer finishes its work and closes. The problem is that I don't know how to show that custom window before all the wizard pages and if it's even possible to do that?
Also, I use ISSI to show the splash screen:
#define ISSI_Splash "C:\InnoSetupProject\Images\client.bmp"
#define ISSI_Splash_T 3
#define ISSI_Splash_X 500
#define ISSI_Splash_Y 220
There's also one problem with that. If I show the MsgBox dialog before the first wizard page and press Cancel on it I want my setup program to close, but instead it shows me the splash screen anyway and then closes. Can I somehow cancel it if I need it in InitializeSetup?
Use the code from:
Is it possible to check if program is already running before trying to install it? (Inno Setup)
(it's your question!)
And just replace IsAppRunning with your IsClientLaunched.
Though, now the question is, whether you need your custom IsClientLaunched at all. You can use the IsAppRunning instead.
According to the CreateCustomPage documentation the parameters for creating a custom page are as follows:
function CreateCustomPage(const AfterID: Integer;
const ACaption,
ADescription: String): TWizardPage;
As you can see, you are providing AfterID which implies you can tell it to show a custom page after a specific builtin page.
But, have you considered using PrepareToInstall? It says:
You can use this event function to detect and install missing
prerequisites and/or to shutdown any application which is about to be
updated.
So maybe you can do your tests there and show any needed pop-up message box. Then, based on the reply, you can return with the appropriate error message. The documentation explains.
There might be other ways to do what you want.

Inno Setup: WizardForm from an external form

I was trying to create an installer for my new project and used an external DLL to call a function to create a custom form. Instead of using the WizardForm, can I create the WizardForm from that custom form?
Here's the code I use to create that form:
procedure NewFormCreate;
var
rt: TTimer;
begin
NewForm:= TForm.Create(nil);
NewForm.BorderStyle := bsNone;
CreateFormFromImage(NewForm.Handle, 'form.png');
rt:= TTimer.create(nil);
rt.OnTimer:= #WFProc;
rt.Interval:= 1;
rt.Enabled:= true;
NewForm.Show;
NewForm.Enabled:= False;
end;
If I understand your question correctly, you want to use your own implementation of the WizardForm.
You cannot. You can only modify the existing WizardForm. Maybe like this:
CreateFormFromImage(WizardForm.Handle, 'form.png');
You can of course create and display your own form, and prevent the WizardForm from even displaying.
But it does not make sense. The Inno Setup is all about the WizardForm. If you do not want to use it, you do not need the Inno Setup at all. Build your custom installer in Delphi (if that's your preferred IDE).
Maybe you should explain us what do you really want to achieve. It's quite probable that you have an XY problem.
Is your X problem creating an installer with irregular shape?
Instead of scripting everything manually you can use Graphical Installer for Inno Setup (http://graphical-installer.com/) and achieve something like this in few minutes:
If you use Delphi you can use RAD & Installer (http://rad-installer.com/) to create the Inno Setup installers directly from RAD Studio IDE.
Sorry for little self promo :)

MFC SDI Application, how to change caption of menu item?

The whole day I am trying to solve this simple issue, but without any success.
I found a lot of hints in internet, but seems, that none of them is valid for my problem.
My issue is quite simple: I want to change the caption of a menue item while runtime
But it seems, that all solutions I found are very specific.
My requirements are this:
- it is a MFC application (VS2010)
- It is a SDI application, not MDI
- I want to change the caption of a main menu item (like "File"), not an entry of a submenue.
Because of main entry item, there is no ID for the menu item. Therefore solutions with ON_UPDATE_COMMAND_UI will not work!
My problems are:
- either the code I tried, is generating an assertion or exception
- or the function call returns with false
- or the function seems to work well, but I do not see any result (the caption is still unchanged)
Maybe I am using the wrong functions, or the wrong place for calling the functions.
Has anybody an example, which would work within my application pre-conditions?
Many, many thanks!
Richard
Windows cleverly hides the function to modify a menu under the arcane name of ModifyMenu. I hate it when they do things like that. Really makes me wish for Linux/Unix, with nice clear names like shmdt and mvwaddchnstr. Anyway, getting off my soap box for the moment, you'd call it something like this:
GetParentFrame()->GetMenu()->ModifyMenuW(1, MF_BYPOSITION, 0, L"New Item");
GetParentFrame()->Invalidate();

How to perform ActionListener() in eclipse

Actually, I want to perform pure mouse actions(Clicking buttons, selecting check boxes, and select radio button)based upon the GUI label(name), But all the tutorials are given the example to perform with JFrame which we have created.
These examples makes me confusing.
Honestly I'm not professional developer. My professional is testing(QA), but I believe I have sufficient programming knowledge to understand the code. Please give me some sample that i can perform in eclipse IDE.
Note:
The objective of my question is:
How to perform the ActionEvent() in existed iDE?(The frame have File menu, Edit menu and so on.) Is it possible to do with Java?
Please share your ideas with me.
Thanks in advance.
Santhosh.
Create a frame.
Put a button into it.
Call the addActionListener class and add a ActionLister object
into it.
Override the actionPerformed method inside the anonymous inner
class.
As your question talks specifically about eclipse. You should use a plugin called window builder, built by google. It helps you handle action events.
Read the oracle's documentation for learning. http://docs.oracle.com/javase/tutorial/uiswing/components/button.html
I can't write all the code here. But just to get you started here's a link. http://www.javaprogrammingforums.com/java-swing-tutorials/278-how-add-actionlistener-jbutton-swing.html.

InnoSetup pascal inheriting TControl causes identifier expected

I am trying to create my own InnoSetup Control (combined dropdown and file input box with browse button). I need dynamic number of these controls. My idea was to inherit TControl and build the needed control like that.
type
TConfigControl = class(TControl)
public
constructor Create(AOwner: TComponent);
end;
I am not avid Pascal programmer but I think the syntax should be correct. When I try to compile the InnoSetup script it gives "Identifier expected" to the second line.
On the other hand, is this the correct way to do this kind of thing in innosetup?
You can create your component in Delphi - regular Pascal allows you to do this.
Inno Setup Script cannot handle such situations (it is pretty complicated).
So develop plug-in (.dll file) and use it to place your control on Wizard's form.

Resources