📄 nmhtml.pas
字号:
function Get_Heading5Font: IFontDisp; safecall;
procedure Set_Heading5Font(const Value: IFontDisp); safecall;
function Get_Heading6Font: IFontDisp; safecall;
procedure Set_Heading6Font(const Value: IFontDisp); safecall;
function Get_IsPrintingDone(PageNumber: Integer): WordBool; safecall;
procedure RequestDoc(const URL: WideString); safecall;
procedure RequestAllEmbedded; safecall;
procedure Cancel(Message: OleVariant); safecall;
procedure BeginPrinting(hDC: Integer; x, y, Width, Height, DefaultHeaders, DefaultTitle: OleVariant); safecall;
procedure PrintPage(hDC, PageNumber: Integer); safecall;
procedure EndPrinting; safecall;
procedure AutoPrint(hDC: Integer); safecall;
function Get_Errors: icErrors; safecall;
function Get_hWnd: OLE_HANDLE; safecall;
function GetPlainText(selected, fancy: WordBool): WideString; safecall;
function HasSelection: WordBool; safecall;
procedure SelectAll; safecall;
property DocInput: DocInput read Get_DocInput;
property DocOutput: DocOutput read Get_DocOutput;
property URL: WideString read Get_URL;
property RequestURL: WideString read Get_RequestURL;
property BaseURL: WideString read Get_BaseURL;
property Forms: HTMLForms read Get_Forms;
property TotalWidth: Integer read Get_TotalWidth;
property TotalHeight: Integer read Get_TotalHeight;
property RetrieveBytesTotal: Integer read Get_RetrieveBytesTotal;
property RetrieveBytesDone: Integer read Get_RetrieveBytesDone;
property ParseDone: WordBool read Get_ParseDone;
property LayoutDone: WordBool read Get_LayoutDone;
property DeferRetrieval: WordBool read Get_DeferRetrieval write Set_DeferRetrieval;
property ViewSource: WordBool read Get_ViewSource write Set_ViewSource;
property RetainSource: WordBool read Get_RetainSource write Set_RetainSource;
property SourceText: WideString read Get_SourceText;
property ElemNotification: WordBool read Get_ElemNotification write Set_ElemNotification;
property Timeout: Integer read Get_Timeout write Set_Timeout;
property Redraw: WordBool read Get_Redraw write Set_Redraw;
property UnderlineLinks: WordBool read Get_UnderlineLinks write Set_UnderlineLinks;
property UseDocColors: WordBool read Get_UseDocColors write Set_UseDocColors;
property BackImage: WideString read Get_BackImage write Set_BackImage;
property BackColor: TColor read Get_BackColor write Set_BackColor;
property ForeColor: TColor read Get_ForeColor write Set_ForeColor;
property LinkColor: TColor read Get_LinkColor write Set_LinkColor;
property VisitedColor: TColor read Get_VisitedColor write Set_VisitedColor;
property DocBackColor: TColor read Get_DocBackColor;
property DocForeColor: TColor read Get_DocForeColor;
property DocLinkColor: TColor read Get_DocLinkColor;
property DocVisitedColor: TColor read Get_DocVisitedColor;
property Font: IFontDisp read Get_Font write Set_Font;
property FixedFont: IFontDisp read Get_FixedFont write Set_FixedFont;
property Heading1Font: IFontDisp read Get_Heading1Font write Set_Heading1Font;
property Heading2Font: IFontDisp read Get_Heading2Font write Set_Heading2Font;
property Heading3Font: IFontDisp read Get_Heading3Font write Set_Heading3Font;
property Heading4Font: IFontDisp read Get_Heading4Font write Set_Heading4Font;
property Heading5Font: IFontDisp read Get_Heading5Font write Set_Heading5Font;
property Heading6Font: IFontDisp read Get_Heading6Font write Set_Heading6Font;
property IsPrintingDone[PageNumber: Integer]: WordBool read Get_IsPrintingDone;
property Errors: icErrors read Get_Errors;
property hWnd: OLE_HANDLE read Get_hWnd;
end;
{ DispInterface declaration for Dual Interface IHTML }
IHTMLDisp = dispinterface
['{B7FC355C-8CE7-11CF-9754-00AA00C00908}']
property DocInput: DocInput readonly dispid 1002;
property DocOutput: DocOutput readonly dispid 1003;
property URL: WideString readonly dispid 1001;
property RequestURL: WideString readonly dispid 2;
property BaseURL: WideString readonly dispid 3;
property Forms: HTMLForms readonly dispid 4;
property TotalWidth: Integer readonly dispid 5;
property TotalHeight: Integer readonly dispid 6;
property RetrieveBytesTotal: Integer readonly dispid 7;
property RetrieveBytesDone: Integer readonly dispid 8;
property ParseDone: WordBool readonly dispid 9;
property LayoutDone: WordBool readonly dispid 10;
property DeferRetrieval: WordBool dispid 11;
property ViewSource: WordBool dispid 12;
property RetainSource: WordBool dispid 13;
property SourceText: WideString readonly dispid 14;
property ElemNotification: WordBool dispid 15;
property Timeout: Integer dispid 507;
property Redraw: WordBool dispid 17;
property UnderlineLinks: WordBool dispid 18;
property UseDocColors: WordBool dispid 19;
property BackImage: WideString dispid 20;
property BackColor: TColor dispid -501;
property ForeColor: TColor dispid -513;
property LinkColor: TColor dispid 21;
property VisitedColor: TColor dispid 22;
property DocBackColor: TColor readonly dispid 23;
property DocForeColor: TColor readonly dispid 24;
property DocLinkColor: TColor readonly dispid 25;
property DocVisitedColor: TColor readonly dispid 26;
property Font: IFontDisp dispid -512;
property FixedFont: IFontDisp dispid 27;
property Heading1Font: IFontDisp dispid 28;
property Heading2Font: IFontDisp dispid 29;
property Heading3Font: IFontDisp dispid 30;
property Heading4Font: IFontDisp dispid 31;
property Heading5Font: IFontDisp dispid 32;
property Heading6Font: IFontDisp dispid 33;
property IsPrintingDone[PageNumber: Integer]: WordBool readonly dispid 39;
procedure RequestDoc(const URL: WideString); dispid 34;
procedure RequestAllEmbedded; dispid 35;
procedure Cancel(Message: OleVariant); dispid 520;
procedure BeginPrinting(hDC: Integer; x, y, Width, Height, DefaultHeaders, DefaultTitle: OleVariant); dispid 36;
procedure PrintPage(hDC, PageNumber: Integer); dispid 37;
procedure EndPrinting; dispid 38;
procedure AutoPrint(hDC: Integer); dispid 50;
property Errors: icErrors readonly dispid 508;
property hWnd: Integer{OLE_HANDLE} readonly dispid -515; //!!
function GetPlainText(selected, fancy: WordBool): WideString; dispid 41;
function HasSelection: WordBool; dispid 42;
procedure SelectAll; dispid 43;
end;
{ HTML Control events }
DHTMLEvents = dispinterface
['{B7FC355D-8CE7-11CF-9754-00AA00C00908}']
procedure Error(Number: Smallint; var Description: WideString; Scode: Integer; const Source, HelpFile: WideString; HelpContext: Integer; var CancelDisplay: WordBool); dispid -608;
procedure DocInput(const DocInput: DocInput); dispid 1016;
procedure DocOutput(const DocOutput: DocOutput); dispid 1017;
procedure ParseComplete; dispid 1;
procedure LayoutComplete; dispid 2;
procedure Timeout; dispid 551;
procedure BeginRetrieval; dispid 4;
procedure UpdateRetrieval; dispid 5;
procedure EndRetrieval; dispid 6;
procedure DoRequestDoc(const URL: WideString; const Element: HTMLElement; const DocInput: DocInput; var EnableDefault: WordBool); dispid 7;
procedure DoRequestEmbedded(const URL: WideString; const Element: HTMLElement; const DocInput: DocInput; var EnableDefault: WordBool); dispid 8;
procedure DoRequestSubmit(const URL: WideString; const Form: HTMLForm; const DocOutput: DocOutput; var EnableDefault: WordBool); dispid 9;
procedure DoNewElement(const ElemType: WideString; EndTag: WordBool; const Attrs: HTMLAttrs; const text: WideString; var EnableDefault: WordBool); dispid 10;
procedure KeyPress(KeyAscii: Smallint); dispid -603;
procedure KeyDown(KeyCode, Shift: Smallint); dispid -602;
procedure KeyUp(KeyCode, Shift: Smallint); dispid -604;
procedure Click; dispid -600;
procedure DblClick; dispid -601;
procedure MouseDown(Button, Shift: Smallint; x: OLE_XPOS_PIXELS; y: OLE_YPOS_PIXELS); dispid -605;
procedure MouseMove(Button, Shift: Smallint; x: OLE_XPOS_PIXELS; y: OLE_YPOS_PIXELS); dispid -606;
procedure MouseUp(Button, Shift: Smallint; x: OLE_XPOS_PIXELS; y: OLE_YPOS_PIXELS); dispid -607;
end;
{ HTML Element }
CoHTMLElementCls = class
class function Create: HTMLElement;
class function CreateRemote(const MachineName: string): HTMLElement;
end;
{ HTML Form object }
CoHTMLFormCls = class
class function Create: HTMLForm;
class function CreateRemote(const MachineName: string): HTMLForm;
end;
{ HTML Forms collection }
CoHTMLFormsCls = class
class function Create: HTMLForms;
class function CreateRemote(const MachineName: string): HTMLForms;
end;
{ HTML Attribute object }
CoHTMLAttrCls = class
class function Create: HTMLAttr;
class function CreateRemote(const MachineName: string): HTMLAttr;
end;
{ HTML Attributes collection }
CoHTMLAttrsCls = class
class function Create: HTMLAttrs;
class function CreateRemote(const MachineName: string): HTMLAttrs;
end;
{ NetManage HTML Client Control }
THTMLError = procedure(Sender: TObject; Number: Smallint; var Description: WideString; Scode: Integer; const Source, HelpFile: WideString; HelpContext: Integer; var CancelDisplay: WordBool) of object;
//!CH Removed const to workaround BCB-9893 (PS and TH investigating proper method to handle this)
THTMLDocInput = procedure(Sender: TObject; {const} DocInput: DocInput) of object;
THTMLDocOutput = procedure(Sender: TObject; {const} DocOutput: DocOutput) of object;
THTMLDoRequestDoc = procedure(Sender: TObject; const URL: WideString; {const} Element: HTMLElement; {const} DocInput: DocInput; var EnableDefault: WordBool) of object;
THTMLDoRequestEmbedded = procedure(Sender: TObject; const URL: WideString; {const} Element: HTMLElement; {const} DocInput: DocInput; var EnableDefault: WordBool) of object;
THTMLDoRequestSubmit = procedure(Sender: TObject; const URL: WideString; {const} Form: HTMLForm; {const} DocOutput: DocOutput; var EnableDefault: WordBool) of object;
THTMLDoNewElement = procedure(Sender: TObject; const ElemType: WideString; EndTag: WordBool; {const} Attrs: HTMLAttrs; const text: WideString; var EnableDefault: WordBool) of object;
THTML = class(TOleControl)
private
FOnError: THTMLError;
FOnDocInput: THTMLDocInput;
FOnDocOutput: THTMLDocOutput;
FOnParseComplete: TNotifyEvent;
FOnLayoutComplete: TNotifyEvent;
FOnTimeout: TNotifyEvent;
FOnBeginRetrieval: TNotifyEvent;
FOnUpdateRetrieval: TNotifyEvent;
FOnEndRetrieval: TNotifyEvent;
FOnDoRequestDoc: THTMLDoRequestDoc;
FOnDoRequestEmbedded: THTMLDoRequestEmbedded;
FOnDoRequestSubmit: THTMLDoRequestSubmit;
FOnDoNewElement: THTMLDoNewElement;
FIntf: IHTML;
function Get_DocInput: DocInput;
function Get_DocOutput: DocOutput;
function Get_Forms: HTMLForms;
function Get_IsPrintingDone(PageNumber: Integer): WordBool;
function Get_Errors: icErrors;
function Get_hWnd: OLE_HANDLE;
protected
procedure InitControlData; override;
procedure InitControlInterface(const Obj: IUnknown); override;
public
procedure AboutBox;
procedure RequestDoc(const URL: WideString);
procedure RequestAllEmbedded;
procedure Cancel(Message: OleVariant);
procedure BeginPrinting(hDC: Integer; x, y, Width, Height, DefaultHeaders, DefaultTitle: OleVariant);
procedure PrintPage(hDC, PageNumber: Integer);
procedure EndPrinting;
procedure AutoPrint(hDC: Integer);
function GetPlainText(selected, fancy: WordBool): WideString;
function HasSelection: WordBool;
procedure SelectAll;
property ControlInterface: IHTML read FIntf;
property BlockResult: Smallint index 519 read GetSmallintProp;
property DocInput: DocInput read Get_DocInput;
property DocOutput: DocOutput read Get_DocOutput;
property URL: WideString index 1001 read GetWideStringProp;
property RequestURL: WideString index 2 read GetWideStringProp;
property BaseURL: WideString index 3 read GetWideStringProp;
property Forms: HTMLForms read Get_Forms;
property TotalWidth: Integer index 5 read GetIntegerProp;
property TotalHeight: Integer index 6 read GetIntegerProp;
property RetrieveBytesTotal: Integer index 7 read GetIntegerProp;
property RetrieveBytesDone: Integer index 8 read GetIntegerProp;
property ParseDone: WordBool index 9 read GetWordBoolProp;
property LayoutDone: WordBool index 10 read GetWordBoolProp;
property SourceText: WideString index 14 read GetWideStringProp;
property DocBackColor: TColor index 23 read GetTColorProp;
property DocForeColor: TColor index 24 read GetTColorProp;
property DocLinkColor: TColor index 25 read GetTColorProp;
property DocVisitedColor: TColor index 26 read GetTColorProp;
property IsPrintingDone[PageNumber: Integer]: WordBool read Get_IsPrintingDone;
property Errors: icErrors read Get_Errors;
property hWnd: OLE_HANDLE read Get_hWnd;
published
property ParentColor;
property ParentFont;
property TabStop;
property Align;
property DragCursor;
property DragMode;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property TabOrder;
property Visible;
property OnDragDrop;
property OnDragOver;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnStartDrag;
property OnMouseUp;
property OnMouseMove;
property OnMouseDown;
property OnKeyUp;
property OnKeyPress;
property OnKeyDown;
property OnDblClick;
property OnClick;
property Blocking: WordBool index 515 read GetWordBoolProp write SetWordBoolProp stored False;
property SleepTime: Integer index 516 read GetIntegerProp write SetIntegerProp stored False;
property DeferRetrieval: WordBool index 11 read GetWordBoolProp write SetWordBoolProp stored False;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -