![]() |
Problem with TEmbeddedWB
Hello!
I have webbrowser with TEmbeddedWB component and I have one problem: I have written procedure, which must read options for webbrowser:
Delphi-Quellcode:
But when I add this procedure somewhere, it doesnt work :( (my webbrowser doesnt load pictures, when "LoadPictures' boolean is true).
procedure TForm1.ReadWBOptions;
begin Ini := TIniFile.Create(ExtractFilePath(Paramstr(0)) + 'data.ini'); try if Ini.ReadBool('Options', 'LoadPictures', True) = True then CurrentWB.DownloadOptions := [DLCTL_DLIMAGES]; except CurrentWB.DownloadOptions := [DLCTL_DLIMAGES]; end; end; When I add somewhere this code(not procedure):
Delphi-Quellcode:
all works great...
Ini := TIniFile.Create(ExtractFilePath(Paramstr(0)) + 'data.ini');
try if Ini.ReadBool('Options', 'LoadPictures', True) = True then CurrentWB.DownloadOptions := [DLCTL_DLIMAGES]; except CurrentWB.DownloadOptions := [DLCTL_DLIMAGES]; end; Where is the trouble? Thank`s! |
Re: Problem with TEmbeddedWB
I do not see coding error in your code.
Might this be a problem with the visibility of the Browser Component. May you can try to give the Procedure the webbrowser as parameter. Good Luck Klaus
Delphi-Quellcode:
procedure TForm1.ReadWBOptions(ABrowser:TEmbeddedWB);
begin Ini := TIniFile.Create(ExtractFilePath(Paramstr(0)) + 'data.ini'); try if Ini.ReadBool('Options', 'LoadPictures', True) = True then ABrowser.DownloadOptions := [DLCTL_DLIMAGES]; except ABrowser.DownloadOptions := [DLCTL_DLIMAGES]; end; end; |
Re: Problem with TEmbeddedWB
It doesnt work :( :wall:
|
Re: Problem with TEmbeddedWB
do you have any code that will set the option to not to load
the pictures? I can see only code that sets the options to Maybe the option will be overwritten somewhere: Are you shure that the inifile is o.k. and can be found? Good luck Klaus |
Re: Problem with TEmbeddedWB
Zitat:
Delphi-Quellcode:
procedure TForm1.ReadWBOptions;
begin Ini := TIniFile.Create(ExtractFilePath(Paramstr(0)) + 'data.ini'); try // if LoadPictures boolean true if Ini.ReadBool('Options', 'LoadPictures', True) = True // then set options(set DLCTL_DLIMAGES true else DLCTL_DLIMAGES = false (by default)) then CurrentWB.DownloadOptions := [DLCTL_DLIMAGES]; except CurrentWB.DownloadOptions := [DLCTL_DLIMAGES]; // if ini file not found end; end; |
Re: Problem with TEmbeddedWB
Sorry it' me again:
maybe there is problem with your inifile [Options] LoadPictures =1 means it will load the pictures [Options] LoadPictures =0 means it will not load the pictures the following code works for me.
Delphi-Quellcode:
May you want to check it.
unit Unit1;
interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, OleCtrls, SHDocVw, EmbeddedWB, inifiles; type TForm1 = class(TForm) EmbeddedWB1: TEmbeddedWB; Button1: TButton; CheckBox1: TCheckBox; procedure Button1Click(Sender: TObject); private procedure ReadWBOptions(ABrowser:TEmbeddedWB); { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.ReadWBOptions(ABrowser:TEmbeddedWB); var ini : TiniFile; begin Ini := TIniFile.Create(ExtractFilePath(Paramstr(0)) + 'data.ini'); if Ini.ReadBool('Options', 'LoadPictures', True) then ABrowser.DownloadOptions := [DLCTL_DLIMAGES]; ini.free; end; procedure TForm1.Button1Click(Sender: TObject); begin ReadWbOptions(EmbeddedWB1); EmbeddedWb1.Go('www.google.de'); end; end. Have fun Klaus [edit] ini.free added [/edit] |
Re: Problem with TEmbeddedWB
Then how to set DLCTL_DLIMAGES to true or to false? It would be well to do this so: Browser.DoanloadOptions.DLCTL_DLIMAGES := True; , but such command not exist...
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 06:11 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz