pascalscript

How to save a UTF-16 with BOM file with Inno Setup

不问归期 提交于 2021-02-07 10:27:03
问题 How to save a string to a text file with UTF-16 (UCS-2) encoding with BOM? The SaveStringsToUTF8File saves as UTF-8. Using streams saves it as ANSI. var i:integer; begin for i := 1 to length(aString) do begin Stream.write(aString[i],1); Stream.write(#0,1); end; stream.free; end; 回答1: As the Unicode string (in the Unicode version of Inno Setup – the only version as of Inno Setup 6) actually uses the UTF-16 LE encoding, all you need to do is to copy the (Unicode) string to a byte array (

Inno Setup Place controls on wpPreparing Page

≡放荡痞女 提交于 2021-02-05 08:01:25
问题 I am trying to place a label on the wpPreparing page to indicate uninstallation of an existing version, prior to running the new installation. Here is my code: function PrepareToInstall(var NeedsRestart: Boolean): String; var UninstallingLabel: TNewStaticText; intResultCode: Integer; begin with UninstallingLabel do begin Caption := 'Uninstalling existing version...'; Left := WizardForm.StatusLabel.Left; Top := WizardForm.StatusLabel.Top; Parent := wpPreparing.Surface; end; if

Can not kill process InnoSetup

99封情书 提交于 2021-02-04 21:42:08
问题 Trying to kill process via InnoSetup installer. But it still shows an error that the processes are running. I use this. [Files] Source: Files\CefSharp.BrowserSubprocess.exe; DestDir: {app}; Flags: overwritereadonly ignoreversion uninsremovereadonly; BeforeInstall: TaskKill('CefSharp.BrowserSubprocess.exe') [Code] procedure TaskKill(fileName: String); var ResultCode: Integer; begin Exec(ExpandConstant('{sys}/taskkill.exe'), '/f /im ' + '"' + fileName + '"', ExpandConstant('{sys}'), SW_HIDE,

How do you determine if an object has be constructed in Inno Setup Pascal Script?

断了今生、忘了曾经 提交于 2021-02-04 21:27:07
问题 How do I check that my checkbox has been created / constructed and can be used to check if checked? [Code] var MyCheckBoxThatMayExistOrNot: TNewCheckBox; procedure Whatever(); begin { Check if MyCheckBoxThatMayExistOrNot exists and checked } if ????? and MyCheckBoxThatMayExistOrNot.Checked then begin ... end; end; TIA!! 回答1: Compare the variable value against nil: if (MyCheckBoxThatMayExistOrNot <> nil) and MyCheckBoxThatMayExistOrNot.Checked then An equivalent is use of Assigned function: if

How do you determine if an object has be constructed in Inno Setup Pascal Script?

无人久伴 提交于 2021-02-04 21:26:03
问题 How do I check that my checkbox has been created / constructed and can be used to check if checked? [Code] var MyCheckBoxThatMayExistOrNot: TNewCheckBox; procedure Whatever(); begin { Check if MyCheckBoxThatMayExistOrNot exists and checked } if ????? and MyCheckBoxThatMayExistOrNot.Checked then begin ... end; end; TIA!! 回答1: Compare the variable value against nil: if (MyCheckBoxThatMayExistOrNot <> nil) and MyCheckBoxThatMayExistOrNot.Checked then An equivalent is use of Assigned function: if

Can you create a custom page that looks like the Finish page?

别来无恙 提交于 2021-02-04 21:01:51
问题 Can you create a custom page that looks like the Finish page? This is the code for custom page, UserPage2 := CreateCustomPage( UserPage1.ID, 'Title', 'Details' ); This custom page, Needs to look like this, The reason for this is because, sometimes when the user runs the installer again they will be able to select few options. Based on the options the installer needs to make few changes to the settings used by the installed program without overwriting the files by reinstalling. So the user

How to check if the string is a valid GUID?

隐身守侯 提交于 2021-01-28 15:30:32
问题 I need to validate the user input and check if the entered string is a valid GUID. How can I do that? Is there a sort of IsValidGuid validation function? 回答1: You can call the Windows API function CLSIDFromString and check (at its failure) if the returned value was not CO_E_CLASSSTRING (which stands for an invalid input string). Calling the built-in StringToGUID function is not reliable as it raises exception from which you're not able to get the reason of the failure. The following function

Conditionally skip to a custom page at the end of the Inno Setup installation wizard without installing?

旧城冷巷雨未停 提交于 2021-01-24 09:06:31
问题 In Inno Setup below is the code used to detect the Next button events, function NextButtonClick(CurPageID: Integer): Boolean; begin case CurPageID of wpLicense: begin // end; wpSelectDir: begin // end; wpSelectComponents: begin // end; wpReady: begin // end; wpFinished: begin // end; else begin /// end; end; end; There is custom page in place that will be shown after the installation is completed and before the finish dialog. At wpSelectDir or wpSelectComponents how can you make the installer

How to add a new page to Inno Setup OuterNotebook?

人盡茶涼 提交于 2021-01-24 08:01:35
问题 As part of an installer I'm working on using Inno Setup, I need to replicate the wpWelcome , page but with a different content. I've created a TNotebookPage , added the image, panel and content I want and it displays as expected. However I'm not sure how to add it to the WizardForm at the location I want. I can force it to appear as the first page, but clicking next/back shifts make the page disappear. How do I insert the notebook page into the OuterNotebook at the relevant position? function

How to add a new page to Inno Setup OuterNotebook?

安稳与你 提交于 2021-01-24 07:56:02
问题 As part of an installer I'm working on using Inno Setup, I need to replicate the wpWelcome , page but with a different content. I've created a TNotebookPage , added the image, panel and content I want and it displays as expected. However I'm not sure how to add it to the WizardForm at the location I want. I can force it to appear as the first page, but clicking next/back shifts make the page disappear. How do I insert the notebook page into the OuterNotebook at the relevant position? function