Форум: "Сети";
Текущий архив: 2005.06.29;
Скачать: [xml.tar.bz2];
ВнизTWebBrowser Найти похожие ветки
← →
rOOse © (2005-03-31 13:32) [0]Не подскажите как отключить, включить отображение рисунков в TWebBrowser?
← →
easy © (2005-03-31 20:14) [1]такая ещё штука -
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, SHDocVw, OleCtrls, ActiveX, StdCtrls;
type
TimgWebBrowser = class(TWebBrowser, IDispatch)
private
FImageEnabled: boolean;
procedure SetImageEnabled(const Value: boolean);
protected
function IDispatch.Invoke = Invoke;
function Invoke(DispID: Integer; const IID: TGUID; LocaleID: Integer;
Flags: Word; var Params; VarResult, ExcepInfo, ArgErr: Pointer): HResult;
stdcall;
public
constructor Create(AOwner: TComponent); override;
published
property ImageEnabled: boolean read FImageEnabled write SetImageEnabled default true;
end;
type
TForm1 = class(TForm)
Button1: TButton;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
imgWebBrowser: TimgWebBrowser;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{ TimgWebBrowser }
constructor TimgWebBrowser.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FImageEnabled := true;
end;
function TimgWebBrowser.Invoke(DispID: Integer; const IID: TGUID;
LocaleID: Integer; Flags: Word; var Params; VarResult, ExcepInfo,
ArgErr: Pointer): HResult;
const
DISPID_AMBIENT_DLCONTROL = -5512;
DLCTL_DLIMAGES = $00000010;
begin
if (Flags and DISPATCH_PROPERTYGET <> 0) and (VarResult <> nil) then
begin
Result := S_OK;
case DispID of
DISPID_AMBIENT_DLCONTROL:
if FImageEnabled then
PVariant(VarResult)^ := Integer(DLCTL_DLIMAGES)
else
PVariant(VarResult)^ := Integer(not DLCTL_DLIMAGES);
else
Result := DISP_E_MEMBERNOTFOUND;
end;
end else
result := inherited invoke(dispid, iid, localeid, flags, params, varresult,
ExcepInfo, argerr);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
imgWebBrowser := TimgWebBrowser.Create(self);
with imgWebBrowser do begin
Align := alclient;
TControl(imgWebBrowser).Parent := form1;
ImageEnabled := false; // Это тут.
Navigate("http://delphimaster.ru");
end;
Button1.BringToFront;
Button1.Caption:="Enbl/Dsbl";
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
imgWebBrowser.Free;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
imgWebBrowser.ImageEnabled:=not imgWebBrowser.ImageEnabled;
end;
procedure TimgWebBrowser.SetImageEnabled(const Value: boolean);
var
path:OleVariant;
begin
if (assigned(Document)) then begin
FImageEnabled := Value;
path:=OleObject.document.location;
RecreateWnd;
Navigate(path);
end;
end;
end.
Страницы: 1 вся ветка
Форум: "Сети";
Текущий архив: 2005.06.29;
Скачать: [xml.tar.bz2];
Память: 0.45 MB
Время: 0.053 c