Colours of controls on custom wizard page are not correct on Windows 7 - Parallels (Inno Script) - windows-7

Context:
MacBook Pro (latest Big Sur 11.1)
Parallels (latest)
Windows 7 (all updates)
When I run my setup, my custom page looks like this:
Some text is showing black. This issue does not happen when you run my installer on native Windows 10 on a PC.
My custom page is designed like this:
// ================================================
// Automatic Backup Settings Page
// ================================================
[Code]
{ Constants }
const
BackupWhat_None = 0;
BackupWhat_Complete = 1;
BackupWhat_Essential = 2;
BackupMode_Automatic = 0;
BackupMode_Manual = 1;
BackupPrompt_Never = 0;
BackupPrompt_Daily = 1;
BackupPrompt_Weekly = 2;
BackupPrompt_Monthly = 3;
{ Global Variables }
var
pageAutoBackup: TWizardPage;
pnlBackupWhat: TPanel;
lblBackupWhat: TLabel;
radBackupWhatNone: TNewRadioButton;
radBackupWhatComplete: TNewRadioButton;
radBackupWhatEssential: TNewRadioButton;
lblBackupMode: TLabel;
pnlBackupMode: TPanel;
radBackupModeAuto: TNewRadioButton;
radBackupModeManual: TNewRadioButton;
lblPromptMode: TLabel;
cmbPromptMode: TNewComboBox;
lblBackupFolder: TLabel;
txtBackupFolder: TNewEdit;
btnSelectBackupFolder: TNewButton;
{ Sets the state of the controls }
procedure EnableAutoBackupSettingPageControls();
var
bEnable: Boolean;
begin
bEnable := radBackupWhatComplete.Checked or radBackupWhatEssential.Checked
pnlBackupMode.Enabled := bEnable;
lblBackupMode.Enabled := bEnable;
radBackupModeAuto.Enabled := bEnable;
radBackupModeManual.Enabled := bEnable;
lblPromptMode.Enabled := bEnable;
cmbPromptMode.Enabled := bEnable;
lblBackupFolder.Enabled := bEnable;
txtBackupFolder.Enabled := bEnable;
btnSelectBackupFolder.Enabled := bEnable;
if(radBackupWhatNone.Checked = True) then
Wizardform.NextButton.Enabled := True
else
Wizardform.NextButton.Enabled := DirExists(txtBackupFolder.Text);
WizardForm.Update;
end;
{ Ask user to select the backup Folder location }
procedure btnSelectBackupFolder_Click(Sender: TObject);
var
strFolder: string;
begin
strFolder := txtBackupFolder.Text;
{ Display Browse Window }
if(BrowseForFolder('', strFolder, True)) then
begin
txtBackupFolder.Text := strFolder;
Wizardform.NextButton.Enabled := DirExists(txtBackupFolder.Text);
WizardForm.Update;
end;
end;
{ Action handler }
procedure radBackupWhat_Click(Sender: TObject);
begin
{ Set control states }
EnableAutoBackupSettingPageControls();
end;
{ Automatic Backup Settings Custom Page }
function pageAutoBackup_CreatePage(PreviousPageId: Integer): Integer;
var
iButtonGap: Integer;
begin
{ Create the page }
pageAutoBackup := CreateCustomPage(PreviousPageId,
ExpandConstant('{cm:pageAutoBackupTitle}'),
ExpandConstant('{cm:pageAutoBackupDescription}'));
{ pnlBackupWhat (TPanel) }
pnlBackupWhat := TPanel.Create(pageAutoBackup);
pnlBackupWhat.Caption := '';
pnlBackupWhat.BevelOuter := bvNone;
pnlBackupWhat.BevelInner := bvNone; { default }
pnlBackupWhat.BevelKind := bkNone;
pnlBackupWhat.Parent := pageAutoBackup.Surface;
pnlBackupWhat.Enabled := True;
pnlBackupWhat.Visible := True;
pnlBackupWhat.Left := ScaleX(0);
pnlBackupWhat.Top := ScaleY(0);
pnlBackupWhat.Width := pageAutoBackup.Surface.Width;
pnlBackupWhat.Anchors := [akLeft, akRight];
{ lblBackupWhat (TLabel) }
lblBackupWhat := TLabel.Create(pageAutoBackup);
lblBackupWhat.Parent := pnlBackupWhat;
lblBackupWhat.Enabled := True;
lblBackupWhat.Visible := True;
lblBackupWhat.Width := pnlBackupWhat.Width;
lblBackupWhat.Caption := ExpandConstant('{cm:lblBackupWhat}');
{ radBackupWhatNone (TNewRadioButton) }
radBackupWhatNone := TNewRadioButton.Create(pageAutoBackup);
radBackupWhatNone.Parent := pnlBackupWhat;
radBackupWhatNone.Enabled := True;
radBackupWhatNone.Visible := True;
radBackupWhatNone.Top := lblBackupWhat.Top + lblBackupWhat.Height + ScaleY(2);
radBackupWhatNone.Width := pnlBackupWhat.Width;
radBackupWhatNone.Height := ScaleY(radBackupWhatNone.Height);
radBackupWhatNone.Checked := False;
radBackupWhatNone.Caption := ExpandConstant('{cm:radBackupWhatNone}');
radBackupWhatNone.OnClick := #radBackupWhat_Click;
{ radBackupWhatComplete (TNewRadioButton) }
radBackupWhatComplete := TNewRadioButton.Create(pageAutoBackup);
radBackupWhatComplete.Parent := pnlBackupWhat;
radBackupWhatComplete.Enabled := True;
radBackupWhatComplete.Visible := True;
radBackupWhatComplete.Top := radBackupWhatNone.Top + radBackupWhatNone.Height + ScaleY(2);
radBackupWhatComplete.Width := pnlBackupWhat.Width;
radBackupWhatComplete.Height := ScaleY(radBackupWhatComplete.Height);
radBackupWhatComplete.Checked := False;
radBackupWhatComplete.Caption := ExpandConstant('{cm:radBackupWhatComplete}');
radBackupWhatComplete.OnClick := #radBackupWhat_Click;
{ radBackupWhatEssential (TNewRadioButton) }
radBackupWhatEssential := TNewRadioButton.Create(pageAutoBackup);
radBackupWhatEssential.Parent := pnlBackupWhat;
radBackupWhatEssential.Enabled := True;
radBackupWhatEssential.Visible := True;
radBackupWhatEssential.Top := radBackupWhatComplete.Top + radBackupWhatComplete.Height + ScaleY(2);
radBackupWhatEssential.Width := pnlBackupWhat.Width;
radBackupWhatEssential.Height := ScaleY(radBackupWhatEssential.Height);
radBackupWhatEssential.Checked := False;
radBackupWhatEssential.Caption := ExpandConstant('{cm:radBackupWhatEssential}');
radBackupWhatEssential.OnClick := #radBackupWhat_Click;
{ Now we can set the panel height! }
pnlBackupWhat.ClientHeight :=
radBackupWhatEssential.Top + radBackupWhatEssential.Height + ScaleY(5);
{ pnlBackupMode (TPanel) }
pnlBackupMode := TPanel.Create(pageAutoBackup);
pnlBackupMode.Caption := '';
pnlBackupMode.BevelOuter := bvNone;
pnlBackupMode.BevelInner := bvNone; { default }
pnlBackupMode.BevelKind := bkNone;
pnlBackupMode.Parent := pageAutoBackup.Surface;
pnlBackupMode.Enabled := True;
pnlBackupMode.Visible := True;
pnlBackupMode.Top := pnlBackupWhat.Top + pnlBackupWhat.Height + ScaleY(2);
pnlBackupMode.Width := pageAutoBackup.Surface.Width;
pnlBackupMode.Height := ScaleY(100);
pnlBackupMode.Anchors := [akLeft, akRight];
{ lblBackupMode (TLabel) }
lblBackupMode := TLabel.Create(pageAutoBackup);
lblBackupMode.Parent := pnlBackupMode;
lblBackupMode.Enabled := True;
lblBackupMode.Visible := True;
lblBackupMode.Width := pnlBackupMode.Width;
lblBackupMode.Caption := ExpandConstant('{cm:lblBackupMode}');
{ radBackupModeAuto (TNewRadioButton) }
radBackupModeAuto := TNewRadioButton.Create(pageAutoBackup);
radBackupModeAuto.Parent := pnlBackupMode;
radBackupModeAuto.Enabled := True;
radBackupModeAuto.Visible := True;
radBackupModeAuto.Left := ScaleX(0);
radBackupModeAuto.Top := lblBackupMode.Top + lblBackupMode.Height + ScaleY(2);
radBackupModeAuto.Width := pnlBackupMode.Width;
radBackupModeAuto.Height := ScaleY(radBackupModeAuto.Height);
radBackupModeAuto.Checked := False;
radBackupModeAuto.Caption := ExpandConstant('{cm:radBackupModeAuto}');
{ radBackupModeManual (TNewRadioButton) }
radBackupModeManual := TNewRadioButton.Create(pageAutoBackup);
radBackupModeManual.Parent := pnlBackupMode;
radBackupModeManual.Enabled := True;
radBackupModeManual.Visible := True;
radBackupModeManual.Top := radBackupModeAuto.Top + radBackupModeAuto.Height + ScaleY(2);
radBackupModeManual.Width := pnlBackupMode.Width;
radBackupModeManual.Height := ScaleY(radBackupModeManual.Height);
radBackupModeManual.Checked := False;
radBackupModeManual.Caption := ExpandConstant('{cm:radBackupModeManual}');
{ lblPromptMode (TLabel) }
lblPromptMode := TLabel.Create(pageAutoBackup);
lblPromptMode.Parent := pnlBackupMode;
lblPromptMode.Enabled := True;
lblPromptMode.Visible := True;
lblPromptMode.Top := radBackupModeManual.Top + radBackupModeManual.Height + ScaleY(10);
lblPromptMode.Width := pnlBackupMode.Width;
lblPromptMode.Caption := ExpandConstant('{cm:lblPromptMode}');
{ cmbPromptMode (TNewComboBox) }
cmbPromptMode := TNewComboBox.Create(pageAutoBackup);
cmbPromptMode.Parent := pnlBackupMode;
cmbPromptMode.Style := csDropDownList;
cmbPromptMode.Enabled := True;
cmbPromptMode.Visible := True;
cmbPromptMode.Top := lblPromptMode.Top + lblPromptMode.Height + ScaleY(5);
cmbPromptMode.Width := pnlBackupMode.Width;
cmbPromptMode.ItemIndex := 0;
cmbPromptMode.Items.Add(ExpandConstant('{cm:cmbPromptModeItemNever}'));
cmbPromptMode.Items.Add(ExpandConstant('{cm:cmbPromptModeItemDaily}'));
cmbPromptMode.Items.Add(ExpandConstant('{cm:cmbPromptModeItemWeekly}'));
cmbPromptMode.Items.Add(ExpandConstant('{cm:cmbPromptModeItemMonthly}'));
cmbPromptMode.Anchors := [akLeft, akRight];
{ Now we can set the panel height! }
pnlBackupMode.ClientHeight :=
(cmbPromptMode.Top + cmbPromptMode.Height) + ScaleY(5);
{ lblBackupFolder (TLabel) }
lblBackupFolder := TLabel.Create(pageAutoBackup);
lblBackupFolder.Parent := pageAutoBackup.Surface;
lblBackupFolder.Enabled := True;
lblBackupFolder.Visible := True;
lblBackupFolder.Top := pnlBackupMode.Top + pnlBackupMode.Height + ScaleY(2);
lblBackupFolder.Width := pnlBackupMode.Width;
lblBackupFolder.Caption := ExpandConstant('{cm:lblBackupFolder}');
lblBackupFolder.Anchors := [akLeft, akRight, akBottom];
{ txtBackupFolder (TNewEdit) }
txtBackupFolder := TNewEdit.Create(pageAutoBackup);
txtBackupFolder.Parent := pageAutoBackup.Surface;
txtBackupFolder.Enabled := True;
txtBackupFolder.ReadOnly := True;
txtBackupFolder.Visible := True;
txtBackupFolder.Top := lblBackupFolder.Top + lblBackupFolder.Height + ScaleY(5);
txtBackupFolder.Anchors := [akLeft, akRight, akBottom];
{ btnSelectBackupFolder (TNewButton) }
btnSelectBackupFolder := TNewButton.Create(pageAutoBackup);
btnSelectBackupFolder.Parent := pageAutoBackup.Surface;
btnSelectBackupFolder.Enabled := True;
btnSelectBackupFolder.Visible := True;
btnSelectBackupFolder.Left := pageAutoBackup.Surface.Width - WizardForm.CancelButton.Width;
btnSelectBackupFolder.Top := txtBackupFolder.Top;
btnSelectBackupFolder.Width := WizardForm.CancelButton.Width;
btnSelectBackupFolder.Height := WizardForm.CancelButton.Height;
btnSelectBackupFolder.Caption := SetupMessage(msgButtonBrowse);
btnSelectBackupFolder.Anchors := [akRight, akBottom];
btnSelectBackupFolder.OnClick := #btnSelectBackupFolder_Click;
{ Now we can set the text box width!
Use the gap between the Next and Cancel buttons for consistency.}
iButtonGap := WizardForm.CancelButton.Left -
(WizardForm.NextButton.Left + WizardForm.NextButton.Width);
txtBackupFolder.Width :=
pageAutoBackup.Surface.Width - btnSelectBackupFolder.Width - iButtonGap;
Result := pageAutoBackup.ID;
end;
function GetWhatToBackupMode(Param: string): string;
begin
if(radBackupWhatComplete.Checked) then
begin
Log('What to backup: Complete backup mode selected.');
Result := IntToStr(BackupWhat_Complete);
end
else if(radBackupWhatEssential.Checked) then
begin
Log('What to backup: Essential backup mode selected.');
Result := IntToStr(BackupWhat_Essential);
end
else begin
Log('What to backup: No backup mode selected.');
Result := IntToStr(BackupWhat_None);
end;
end;
function GetHowToBackupMode (Param: string): string;
begin
if(radBackupModeManual.Checked) then
begin
Log('How to backup: Perform the backup manually.');
Result := IntToStr(BackupMode_Manual);
end
else begin
Log('How to backup: Perform the backup automatically.');
Result := IntToStr(BackupMode_Automatic);
end;
end;
function GetBackupPromptMode (Param: string): string;
begin
Log('Where to backup: ' + cmbPromptMode.Items[cmbPromptMode.ItemIndex]);
Result := IntToStr(cmbPromptMode.ItemIndex);
end;
function GetBackupLocationPath (Param: string): string;
begin
// If empty, use the app folder and create a backup folder (Param)
Log(txtBackupFolder.Text);
Result := txtBackupFolder.Text;
end;
procedure AutoBackupPage_InitializeWizard(AfterId: Integer);
var
dwBackupAtShutdownWhat: Cardinal;
dwBackupAtShutdownHow: Cardinal;
dwBackupPromptMode: Cardinal;
strBackupFolder: String;
begin
pageAutoBackup_CreatePage(AfterId);
{ What to Backup }
dwBackupAtShutdownWhat := BackupWhat_None;
if (IsWin64) then
begin
RegQueryDWordValue(HKLM64,
'Software\MeetSchedAssist\Meeting Schedule Assistant\Options',
'BackupAtShutdownWhat', dwBackupAtShutdownWhat)
end else
begin
RegQueryDWordValue(HKLM,
'Software\MeetSchedAssist\Meeting Schedule Assistant\Options',
'BackupAtShutdownWhat', dwBackupAtShutdownWhat);
end;
if (dwBackupAtShutdownWhat = BackupWhat_Complete) then
begin
radBackupWhatComplete.Checked := True;
end
else if (dwBackupAtShutdownWhat = BackupWhat_Essential) then
begin
radBackupWhatEssential.Checked := True;
end
else begin
radBackupWhatNone.Checked := True;
end;
{ How to Backup }
dwBackupAtShutdownHow := BackupMode_Automatic;
if (IsWin64) then
begin
RegQueryDWordValue(HKLM64,
'Software\MeetSchedAssist\Meeting Schedule Assistant\Options',
'BackupAtShutdownMode', dwBackupAtShutdownHow);
end else
begin
RegQueryDWordValue(HKLM,
'Software\MeetSchedAssist\Meeting Schedule Assistant\Options',
'BackupAtShutdownMode', dwBackupAtShutdownHow);
end;
if (dwBackupAtShutdownHow = BackupMode_Manual) then
begin
radBackupModeManual.Checked := True;
end
else begin
radBackupModeAuto.Checked := True;
end;
{ Backup Prompt Mode }
dwBackupPromptMode := BackupPrompt_Never;
if (IsWin64) then
begin
RegQueryDWordValue(HKLM64,
'Software\MeetSchedAssist\Meeting Schedule Assistant\Options',
'BackupPromptMode', dwBackupPromptMode);
end else
begin
RegQueryDWordValue(HKLM,
'Software\MeetSchedAssist\Meeting Schedule Assistant\Options',
'BackupPromptMode', dwBackupPromptMode);
end;
cmbPromptMode.ItemIndex := dwBackupPromptMode;
{ Backup Local Path }
strBackupFolder := '';
if (IsWin64) then
begin
RegQueryStringValue(HKLM64,
'Software\MeetSchedAssist\Meeting Schedule Assistant\Options',
'BackupAtShutdownLocalPath', strBackupFolder);
end else
begin
RegQueryStringValue(HKLM,
'Software\MeetSchedAssist\Meeting Schedule Assistant\Options',
'BackupAtShutdownLocalPath', strBackupFolder);
end;
{ Do we need to reset the existing folder? }
if(not DirExists(strBackupFolder)) then strBackupFolder := '';
txtBackupFolder.Text := strBackupFolder;
end;
procedure AutoBackupPage_CurPageChanged(CurPageID: Integer);
begin
if CurPageID = pageAutoBackup.ID then
begin
{ Get the state of the Next button correct }
if(radBackupWhatNone.Checked) then
Wizardform.NextButton.Enabled := True
else
Wizardform.NextButton.Enabled := DirExists(txtBackupFolder.Text);
WizardForm.Update;
end;
end;
{ Build the Memo text for the Auto Backup Settings page }
function AutoBackupPage_MemoInfo(Space, NewLine: String): String;
begin
Result := Result + ExpandConstant('{cm:pageAutoBackupTitle}') + NewLine;
{ What to Backup }
Result := Result + Space + ExpandConstant('{cm:lblBackupWhat}') + NewLine;
if(radBackupWhatNone.Checked) then
Result := Result + Space + Space + ExpandConstant('{cm:radBackupWhatNone}') + NewLine;
if(radBackupWhatComplete.Checked) then
Result := Result + Space + Space + ExpandConstant('{cm:radBackupWhatComplete}') + NewLine;
if(radBackupWhatEssential.Checked) then
Result := Result + Space + Space + ExpandConstant('{cm:radBackupWhatEssential}') + NewLine;
if(radBackupWhatNone.Checked = False) then
begin
{ How to Backup }
Result := Result + Space + ExpandConstant('{cm:lblBackupMode}') + NewLine;
if(radBackupModeAuto.Checked) then
Result := Result + Space + Space + ExpandConstant('{cm:radBackupModeAuto}') + NewLine;
if(radBackupModeManual.Checked) then
Result := Result + Space + Space + ExpandConstant('{cm:radBackupModeManual}') + NewLine;
{ Prompt Mode }
Result := Result + Space + Space + ExpandConstant('{cm:lblPromptMode}') + NewLine;
if(cmbPromptMode.ItemIndex = BackupPrompt_Never) then
Result := Result + Space + Space + Space + ExpandConstant('{cm:cmbPromptModeItemNever}') + NewLine;
if(cmbPromptMode.ItemIndex = BackupPrompt_Daily) then
Result := Result + Space + Space + Space + ExpandConstant('{cm:cmbPromptModeItemDaily}') + NewLine;
if(cmbPromptMode.ItemIndex = BackupPrompt_Weekly) then
Result := Result + Space + Space + Space + ExpandConstant('{cm:cmbPromptModeItemWeekly}') + NewLine;
if(cmbPromptMode.ItemIndex = BackupPrompt_Monthly) then
Result := Result + Space + Space + Space + ExpandConstant('{cm:cmbPromptModeItemMonthly}') + NewLine;
{ Backup Folder }
Result := Result + Space + ExpandConstant('{cm:lblBackupFolder}') + NewLine;
Result := Result + Space + Space + txtBackupFolder.Text + NewLine;
end;
Result := Result + NewLine;
end;
I am using skinning as you can see (#define Skin "Amakrits.vsf").
I didn't anticipate this rendering issue.

Works fine for me on latest Win 10.
Your picture shows you have selected "Don't perform..." option which disables the controls in next group, that is a reason why the controls have different colors.
Did you make any changes in the skin file Amakrits.vsf? My skin looks different (I downloaded it from GitHub few moments ago) and it looks like some tweaks are missing in my case.
Conclusion: this is not an Inno Setup issue, but problem in VCL skinning plugin (try to post your issue here: https://github.com/RRUZ/vcl-styles-plugins/issues), but it looks like it can be improved by tweaking the colors in used .vsf file.
P.S. your script could not be compiled correctly as there were missing Custom Messages and skin / setup initialization functions.

Related

Indy IdHttp Digest Authentication - 401

When you try to take a picture from a camera, the authentication function does not work. I read all the other posts on the subject, but without success with this device.
Indy 10.6.2.0
Uses ..., IdAuthentication, IdAuthenticationDigest;
...
addr := 'cgi-bin/snapshot.cgi?1';
myADR := 'http://87.126.245.25:8181/' + addr;
rStream := TMemoryStream.Create;
try
H1 := TIdHttp.Create();
{$IFDEF DEBUG}
idLogFile := TIdLogFile.Create( H1 );
with idLogFile do begin
Filename := IncludeTrailingPathDelimiter( ExtractFileDir( Application.ExeName ) ) + 'indy_log.txt';
Active := true;
end;
{$ENDIF}
with H1 do begin
Response.KeepAlive := true;
ReadTimeout := selCAM.Timeout;
Request.BasicAuthentication := false;
Request.Username := selCAM.User;
Request.Password := selCAM.Pass;
Request.ContentType := 'image/jpeg';
Request.UserAgent := 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/97.0.4692.71';
Request.ContentVersion := '1.0';
Request.IPVersion := Id_IPv4;
Request.Host := 'http://' + addr;
HTTPOptions := [hoInProcessAuth, hoForceEncodeParams];
OnSelectAuthorization := IdHTTP_SelectAuthorization;
OnHeadersAvailable := IdHTTP_HeadersAvailable;
OnAuthorization := IdHTTP_Authorization;
{$IFDEF DEBUG} Intercept := idLogFile; {$ENDIF}
end;
try
H1.Get( myADR, rStream); except
on E: EIdHTTPProtocolException do begin SB1.Panels[0].Text := E.Message; er := true; end;
on E: EIdException do begin SB1.Panels[0].Text := E.Message; er := true; end;
on E: Exception do begin SB1.Panels[0].Text := E.Message; er := true; end;
end;
finally
H1.Free;
FreeAndNil(rStream);
end;
It works correctly through a browser
Attach wireshark from Browser, from Indy and Indy Log:
https://1drv.ms/u/s!AubiEh1vqvRLkr01GzXCf_T0yLgmfQ?e=69dqaD

Why is my Delphi code not executing in order?

I am creating a program, and I need to display an image and then block input for a few seconds before allowing it again. The problem I am running into is that Delphi is not running the code in order and is executing the Sleep() command before the image command. I have run into this problem before when using Sleep() with a video before displaying a message.
The code looks as follows:
procedure TtForm.WindowsMediaPlayer2Click(ASender: TObject;
nButton, nShiftState: SmallInt; fX, fY: Integer);
Var
buttonSelected: Integer;
begin
buttonSelected := MessageDlg('Well done Monkey!-_-', mtError, mbOKCancel, 0);
if buttonSelected = mrOK then
begin
Pages.Visible := False;
WindowsMediaPlayer2.Visible := False;
imgEroor.BringToFront;
BorderStyle := bsNone;
WindowState := wsMaximized;
imgEroor.Top := 0;
imgEroor.Left := 0;
imgEroor.Width := Screen.Width;
imgEroor.Height := Screen.Height;
imgEroor.BringToFront;
BlockInput(True);
Sleep(10000);
BlockInput(False);
end;
if buttonSelected = mrCancel then
begin
Pages.Visible := False;
WindowsMediaPlayer2.Visible := False;
imgEroor.BringToFront;
BorderStyle := bsNone;
WindowState := wsMaximized;
imgEroor.Top := 0;
imgEroor.Left := 0;
imgEroor.Width := Screen.Width;
imgEroor.Height := Screen.Height;
imgEroor.BringToFront;
BlockInput(True);
Sleep(10000);
BlockInput(False);
end;
end;

Delphi: EoleSysError Exception

I get an EoleSysError exception after executing this line of code:
FContainer.DoVerb(ovShow);
When I open several word documents in the form, the exception doesn't occur.
Here is an picture of the exception.
For some reason, the error occurs when I want to open an excel file in the form
This is my current code:
procedure TForm1.FormActivate(Sender: TObject);
var
FDocument, FWord:Variant;
FContainer: TOleContainer;
begin
FContainer := TOleContainer.Create(olecontainer1);
FContainer.Modified := false;
FContainer.Parent := olecontainer1;
FContainer.Align := alClient;
FContainer.CreateObject('Word.Document', true);
FDocument := IDispatch(FContainer.OleObject);
FWord := FDocument.Application;
FContainer.DoVerb(ovShow);
// olecontainer2
FContainer := TOleContainer.Create(olecontainer2);
FContainer.Modified := false;
FContainer.Parent := olecontainer2;
FContainer.Align := alClient;
FContainer.CreateObject('Excel.Application', true);
FDocument := IDispatch(FContainer.OleObject);
FWord := FDocument.Application;
FContainer.DoVerb(ovShow);
FContainer := TOleContainer.Create(olecontainer3);
FContainer.Modified := false;
FContainer.Parent := olecontainer3;
FContainer.Align := alClient;
FContainer.CreateObject('Word.Document', true);
FDocument := IDispatch(FContainer.OleObject);
FWord := FDocument.Application;
FContainer.DoVerb(ovShow);
FContainer := TOleContainer.Create(olecontainer4);
FContainer.Modified := false;
FContainer.Parent := olecontainer4;
FContainer.Align := alClient;
FContainer.CreateObject('Excel.Application', true);
FDocument := IDispatch(FContainer.OleObject);
FWord := FDocument.Application;
FContainer.DoVerb(ovShow);
end;

indy TIdHTTPP socket error #110004 bad adress

I am trying to get result from yahoo search and save those result into file. However, there is an Exception while i use IdHTTP.Get it shows 'Exception, Socket Error # 10014 Bad address.'. below is my code:
function TfrmIdHTTP.GetYahooSearch(const aSearch: String;
var aResponse: String): Boolean;
var
mHost, mPath, mQuery : String;
mResult, mStrBlock : String;
mQueryStream : TStringStream;
mResultStream : TStringStream;
begin
Result := False;
Try
pbStatus.Position := 10;
mHost := 'http://www.yahoo.com';
mPath := '/';
mQueryStream := TStringStream.Create('');
mResultStream := TStringStream.Create('');
IdHTTP.HandleRedirects := True;
IdHTTP.Request.ContentType := 'application/x-www-form-urlencoded';
pbStatus.Position := 30;
IdHTTP.Get(mHost + mPath, mResultStream);
showmessage('1');
mResult := mResultStream.DataString;
SaveFile('yahoo_search_01.htm', mResult, True);
pbStatus.Position := 50;
mStrBlock := StringCrop(mResult, '<form', '</form>',1);
if PosEx('role="search"', mStrBlock) = 0 then
begin
aResponse := 'Error, please check and try again later';
Exit;
end;
pbStatus.Position := 70;
mHost := 'http://www.yahoo.com';
mPath := '/search';
mQuery := 'toggle=' + Utf8ToAnsi(StringCrop(mStrBlock, 'name="toggle" value="', '">', 1))
+ '&cop=' + Utf8ToAnsi(StringCrop(mStrBlock, 'name="cop" value="', '">', 1))
+ '&ei=' + Utf8ToAnsi(StringCrop(mStrBlock, 'name="ei" value="', '">', 1))
+ '&.tsrc=' + Utf8ToAnsi(StringCrop(mStrBlock, 'name=".tsrc" value="', '">', 1))
+ '&p=' + Utf8ToAnsi(Trim(edtSearch.Text))
;
mQueryStream.WriteString(mQuery);
pbStatus.Position := 90;
IdHTTP.Post(mHost + mPath, mQueryStream, mResultStream);
mResult := mResultStream.DataString;
SaveFile('yahoo_search_02.htm', mResult, True);
Except
on E:Exception do begin
aResponse := Format('%s, %s', ['Exception', e.Message]);
Exit;
end;
end;
aResponse := mResult;
Result := True;
end;

Inno Setup - How to change a label caption [or other controls in general], when selected value in combox box changes

When changing a language in combo box (without clicking ok), I want to change texts of the dialog (label, form caption, button caption)
procedure SelectLanguage();
var
LanguageForm: TSetupForm;
CancelButton: TNewButton;
OKButton: TNewButton;
LangCombo: TNewComboBox;
SelectLabel: TNewStaticText;
Languages: TStrings;
Params: string;
Instance: THandle;
P, I: Integer;
S, L: string;
begin
Languages := TStringList.Create();
Languages.Add('en=English');
Languages.Add('cs='+#$010C+'e'+#$0161+'tina');
LanguageForm := CreateCustomForm;
LanguageForm.Caption := SetupMessage(msgSelectLanguageTitle);
LanguageForm.ClientWidth := ScaleX(297);
LanguageForm.ClientHeight := ScaleY(125);
LanguageForm.BorderStyle := bsDialog;
LanguageForm.Center;
CancelButton := TNewButton.Create(LanguageForm);
CancelButton.Parent := LanguageForm;
CancelButton.Left := ScaleX(214);
CancelButton.Top := ScaleY(93);
CancelButton.Width := ScaleY(75);
CancelButton.Height := ScaleY(23);
CancelButton.TabOrder := 3;
CancelButton.ModalResult := mrCancel;
CancelButton.Caption := SetupMessage(msgButtonCancel);
OKButton := TNewButton.Create(LanguageForm);
OKButton.Parent := LanguageForm;
OKButton.Left := ScaleX(133);
OKButton.Top := ScaleY(93);
OKButton.Width := ScaleX(75);
OKButton.Height := ScaleY(23);
OKButton.Caption := SetupMessage(msgButtonOK);
OKButton.Default := True
OKButton.ModalResult := mrOK;
OKButton.TabOrder := 2;
LangCombo := TNewComboBox.Create(LanguageForm);
LangCombo.Parent := LanguageForm;
LangCombo.Left := ScaleX(16);
LangCombo.Top := ScaleY(56);
LangCombo.Width := ScaleX(273);
LangCombo.Height := ScaleY(21);
LangCombo.Style := csDropDownList;
LangCombo.DropDownCount := 16;
LangCombo.TabOrder := 1;
SelectLabel := TNewStaticText.Create(LanguageForm);
SelectLabel.Parent := LanguageForm;
SelectLabel.Left := ScaleX(16);
SelectLabel.Top := ScaleY(8);
SelectLabel.Width := ScaleX(273);
SelectLabel.Height := ScaleY(39);
SelectLabel.AutoSize := False
SelectLabel.Caption := SetupMessage(msgSelectLanguageLabel);
SelectLabel.TabOrder := 0;
SelectLabel.WordWrap := True;
for I := 0 to Languages.Count - 1 do
begin
P := Pos('=', Languages.Strings[I]);
L := Copy(Languages.Strings[I], 0, P - 1);
S := Copy(Languages.Strings[I], P + 1, Length(Languages.Strings[I]) - P);
LangCombo.Items.Add(S);
if L = ActiveLanguage then
LangCombo.ItemIndex := I;
end;
if LanguageForm.ShowModal = mrOK then
begin
{ ... }
end;
end;
function InitializeSetup(): Boolean;
begin
SelectLanguage();
{ ... }
end;
Spanish: first language.
I select English and no change the language of the language selector.
You have the code already. You just need to make some local variables in the SelectLanguage function global, so they can be used in the LangChange function:
var
LanguageForm: TSetupForm;
SelectLabel: TNewStaticText;
CancelButton: TNewButton;
procedure LangChange(Sender : TObject);
begin
case TNewComboBox(Sender).ItemIndex of
0: { English }
begin
SelectLabel.Caption := 'Select the language to use during the installation:';
CancelButton.Caption := 'Cancel';
LanguageForm.Caption := 'Select setup language';
end;
1: { Czech }
begin
SelectLabel.Caption := 'Zvolte jazyk, kter'+#$FD+' se m'+#$E1+' pou'+#$17E+#$ED+'t b'+#$11B+'hem instalace:';
CancelButton.Caption := 'Storno';
LanguageForm.Caption := 'V'+#$FD+'b'+#$11B+'r jazyka pr'+#$16F+'vodce instalac'+#$ED+'';
end;
end;
end;
In the SelectLanguage, remove these the declarations of local variables:
LanguageForm: TSetupForm;
SelectLabel: TNewStaticText;
CancelButton: TNewButton;
And assign the LangChange event handler:
LangCombo.OnChange := #LangChange;

Resources