AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Netzwerke Delphi Problem with TEmbeddedWB
Thema durchsuchen
Ansicht
Themen-Optionen

Problem with TEmbeddedWB

Ein Thema von alpha1 · begonnen am 22. Mai 2006 · letzter Beitrag vom 22. Mai 2006
Antwort Antwort
alpha1

Registriert seit: 19. Nov 2005
40 Beiträge
 
#1

Problem with TEmbeddedWB

  Alt 22. Mai 2006, 17:17
Hello!
I have webbrowser with TEmbeddedWB component and I have one problem:
I have written procedure, which must read options for webbrowser:
Delphi-Quellcode:
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;
But when I add this procedure somewhere, it doesnt work (my webbrowser doesnt load pictures, when "LoadPictures' boolean is true).
When I add somewhere this code(not procedure):
Delphi-Quellcode:
 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;
all works great...
Where is the trouble?
Thank`s!
  Mit Zitat antworten Zitat
Klaus01

Registriert seit: 30. Nov 2005
Ort: München
5.771 Beiträge
 
Delphi 10.4 Sydney
 
#2

Re: Problem with TEmbeddedWB

  Alt 22. Mai 2006, 17:31
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;
Klaus
  Mit Zitat antworten Zitat
alpha1

Registriert seit: 19. Nov 2005
40 Beiträge
 
#3

Re: Problem with TEmbeddedWB

  Alt 22. Mai 2006, 17:48
It doesnt work
  Mit Zitat antworten Zitat
Klaus01

Registriert seit: 30. Nov 2005
Ort: München
5.771 Beiträge
 
Delphi 10.4 Sydney
 
#4

Re: Problem with TEmbeddedWB

  Alt 22. Mai 2006, 17:55
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
Klaus
  Mit Zitat antworten Zitat
alpha1

Registriert seit: 19. Nov 2005
40 Beiträge
 
#5

Re: Problem with TEmbeddedWB

  Alt 22. Mai 2006, 18:21
Zitat von Klaus01:
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
Ini file is ok...

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;
  Mit Zitat antworten Zitat
Klaus01

Registriert seit: 30. Nov 2005
Ort: München
5.771 Beiträge
 
Delphi 10.4 Sydney
 
#6

Re: Problem with TEmbeddedWB

  Alt 22. Mai 2006, 19:36
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:
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.
May you want to check it.

Have fun
Klaus

[edit] ini.free added [/edit]
Klaus
  Mit Zitat antworten Zitat
alpha1

Registriert seit: 19. Nov 2005
40 Beiträge
 
#7

Re: Problem with TEmbeddedWB

  Alt 22. Mai 2006, 20:26
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...
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 08:00 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz