procedure TForm1.FormCreate(Sender: TObject);
begin
webbrowser1.Navigate('http:\\localhost');
end;
procedure TForm1.ApplicationEvents1Message(var Msg: tagMSG;
var Handled: Boolean);
begin
if ((Msg.message=wm_rbuttondown)or(Msg.message=wm_rbuttonup)) then//and (鼠标是否在webbrower内)then begin
Handled:=true;
public
{ Public declarations }
procedure OnAppMsg(var msg: tmsg;var handled: boolean);
procedure TForm1.FormCreate(Sender: TObject);
begin
WebBrowser1.Navigate('http://www.163.com');
Application.OnMessage := OnAppMsg;
end;
procedure TForm1.OnAppMsg(var msg: tmsg; var handled: boolean);
begin
if (msg.message = wm_rbuttondown) then
begin
showmessage(inttostr(WebBrowser1.Handle));
//showmessage(inttostr(windowfrompoint(ScreenToClient(msg.pt))));
// showmessage(inttostr(msg.lParam));
//showmessage(inttostr(longint(@msg.wParam)));
showmessage('trap browser mouse');
end
else
inherited;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
WebBrowser1.Navigate('http://www.163.com');
Application.OnMessage := OnAppMsg;
end;
procedure TForm1.OnAppMsg(var msg: tmsg; var handled: boolean);
begin
if (msg.message = wm_rbuttondown) then
begin
showmessage(inttostr(WebBrowser1.Handle));
showmessage(inttostr(windowfrompoint(msg.pt)));
showmessage(inttostr(msg.lParam));
showmessage(inttostr(longint(@msg.wParam)));
showmessage('trap browser mouse');
end
else
inherited;
end;