unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, OleCtrls, SHDocVw_TLB;
type
TMoveEvent =
procedure (Sender: TObject; X, Y: Integer)
of object;
TWebBrowser =
class(SHDocVw_TLB.TWebBrowser)
private
{ Private-Deklarationen }
FOnMouseMove: TMoveEvent;
FOnMouseLeave: TNotifyEvent;
procedure WMMOUSEMOVE(
var Message: TMessage);
message WM_MOUSEMOVE;
procedure CMMOUSELEAVE(
var Message: TMessage);
message CM_MOUSELEAVE;
public
property OnMouseMove: TMoveEvent
read FOnMouseMove
write FOnMouseMove;
property OnMouseLeave: TNotifyEvent
read FOnMouseLeave
write FOnMouseLeave;
end;
type
TForm1 =
class(TForm)
WebBrowser1: TWebBrowser;
procedure FormCreate(Sender: TObject);
private
procedure WMMOUSEMOVE(Sender: TObject; X, Y: Integer);
procedure CMMOUSELEAVE(Sender: TObject);
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TWebBrowser.WMMOUSEMOVE(
var Message: TMessage);
begin
if assigned(FOnMouseMove)
then
FOnMouseMove(Self,
Message.LParamLo,
Message.LParamHi);
end;
procedure TWebBrowser.CMMOUSELEAVE(
var Message: TMessage);
begin
if assigned(FOnMouseLeave)
then
FOnMouseLeave(Self);
end;
procedure TForm1.WMMOUSEMOVE(Sender: TObject; X, Y: Integer);
begin
Caption:= Format('
WM_MOUSEMOVE X:%d Y:%d', [X, Y]);
end;
procedure TForm1.CMMOUSELEAVE(Sender: TObject);
begin
Caption:= '
CM_MOUSELEAVE';
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
WebBrowser1.OnMouseMove:= WMMOUSEMOVE;
WebBrowser1.OnMouseLeave:= CMMOUSELEAVE;
end;
end.