| 1 |
unit BrowserRecord; |
| 2 |
|
| 3 |
interface |
| 4 |
|
| 5 |
uses |
| 6 |
Windows, OleCtrls, ActiveX, |
| 7 |
{$IF Defined(DELPRO) } |
| 8 |
SHDocVw, |
| 9 |
MSHTML, |
| 10 |
{$ELSE} |
| 11 |
SHDocVw_TLB, |
| 12 |
MSHTML_TLB, |
| 13 |
{$IFEND} |
| 14 |
BoardGroup, HTMLDocumentEvent; |
| 15 |
|
| 16 |
type |
| 17 |
TBrowserRecord = class( TObject ) |
| 18 |
private |
| 19 |
FBrowser : TWebBrowser; |
| 20 |
FEvent: THTMLDocumentEventSink; ///< ???????吟?????ャ?<?潟???ゃ???潟?? |
| 21 |
FThread : TThreadItem; |
| 22 |
FLastSize : Integer; |
| 23 |
FRepaint : Boolean; |
| 24 |
FMovement : string; ///< ?鴻?????若?????≪?潟????/span> |
| 25 |
public |
| 26 |
destructor Destroy; override; |
| 27 |
property Event : THTMLDocumentEventSink read FEvent write FEvent; |
| 28 |
property Browser : TWebBrowser read FBrowser write FBrowser; |
| 29 |
property Thread : TThreadItem read FThread write FThread; |
| 30 |
property LastSize : Integer read FLastSize write FLastSize; |
| 31 |
property Repaint : Boolean read FRepaint write FRepaint; |
| 32 |
property Movement : string read FMovement write FMovement; |
| 33 |
end; |
| 34 |
// BrowserRecord???ゃ????????FBrowser??紊??? |
| 35 |
procedure ReleaseBrowser( BRecord: TBrowserRecord); |
| 36 |
|
| 37 |
implementation |
| 38 |
// ************************************************************************* |
| 39 |
//! BrowserRecord???ゃ????????FBrowser??紊??? |
| 40 |
// ************************************************************************* |
| 41 |
procedure ReleaseBrowser( BRecord: TBrowserRecord); |
| 42 |
begin |
| 43 |
if BRecord <> nil then begin |
| 44 |
BRecord.Browser := nil; |
| 45 |
if BRecord.Event <> nil then begin |
| 46 |
BRecord.Event.Free; |
| 47 |
BRecord.Event := nil; |
| 48 |
end; |
| 49 |
BRecord.Repaint := true; |
| 50 |
end; |
| 51 |
end; |
| 52 |
// ************************************************************************* |
| 53 |
//! BrowserRecord?????鴻????????/span> |
| 54 |
// ************************************************************************* |
| 55 |
destructor TBrowserRecord.Destroy; |
| 56 |
var |
| 57 |
doc :OleVariant; |
| 58 |
begin |
| 59 |
if Self.FEvent <> nil then |
| 60 |
Self.FEvent.Free; |
| 61 |
if Self.FBrowser <> nil then begin |
| 62 |
if Self.Thread <> nil then begin |
| 63 |
//?帥????奨???у奨?????????鴻????????祉??????????????????????????/span> |
| 64 |
//???????????鴻?????若?????篆?絖????????障?????????????祉?c?????障???? |
| 65 |
if Self.FBrowser.OleObject.Document.documentElement.innerText <> '' then begin |
| 66 |
doc := Idispatch( olevariant(Self.FBrowser.ControlInterface).Document) as IHTMLDocument2; |
| 67 |
Self.Thread.ScrollTop := doc.Body.ScrollTop; |
| 68 |
end; |
| 69 |
end; |
| 70 |
//TOleControl(Self.FBrowser).Visible := false; |
| 71 |
ShowWindow(Self.FBrowser.Handle, SW_HIDE); |
| 72 |
end; |
| 73 |
|
| 74 |
end; |
| 75 |
|
| 76 |
|
| 77 |
end. |