全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:1756
推到 Plurk!
推到 Facebook!

請問設計WebBrowser元件的問題

缺席
frappe
中階會員


發表:88
回覆:114
積分:95
註冊:2008-10-21

發送簡訊給我
#1 引用回覆 回覆 發表時間:2008-11-26 11:17:25 IP:115.81.xxx.xxx 訂閱
我想設計一個可以把網頁原始碼複製到Memo的元件
屬性選擇Memo之後在OnDocumentComplete事件自動複製到Memo,
我繼承TWebBrowser,但是Compile說找不到這個Event
Method OnDocumentComplete not found in base event
不知道是不是我的觀念有錯呢?


[code delphi]
unit SeanWebBrowser;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, OleCtrls, SHDocVw;

type
TSeanWebBrowser = class(TWebBrowser)
private
{ Private declarations }
MMZ: TMemo;
AuthorName: String;
function GetMemo: TMemo;
procedure SetMemo(Value: TMemo);
protected
{ Protected declarations }
public
{ Public declarations }
constructor Create(AOwner : TComponent); override;
procedure OnDocumentComplete(ASender: TObject;
const pDisp: IDispatch; var URL: OleVariant); override; //<----錯誤
published
{ Published declarations }
property Memo: TMemo read GetMemo write SetMemo;
property Author: String read AuthorName write AuthorName;
property Tag;
end;


implementation
uses
MSHTML;
procedure TSeanWebBrowser.OnDocumentComplete(ASender: TObject; //<----錯誤
const pDisp: IDispatch; var URL: OleVariant);
var
Doc: IHTMLDocument2;
i:Integer;
strkey,str2:String;
begin
inherited;
Doc := TSeanWebBrowser.Document as IHTMLDocument2;
MMZ.Lines.Text := doc.body;
end;
function TSeanWebBrowser.GetMemo: TMemo;
begin
result:= MMZ;
end;
procedure TSeanWebBrowser.SetMemo(Value: TMemo);
begin
MMZ:= Value;
end;
constructor TSeanWebBrowser.Create(AOwner: TComponent);
begin
inherited;

end;
end.

[/code]
編輯記錄
frappe 重新編輯於 2008-11-26 11:19:48, 註解 無‧
frappe 重新編輯於 2008-11-26 11:21:20, 註解 無‧
系統時間:2024-04-25 16:06:36
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!