<form action="" name="form1" mathod="get">
<input type="text" name="test1" />
</form>
那我想在鼠标移到input上面的时候,就可以解得到input的名称为test1以及所属的表单名form1和方法
请教高手
13 个解决方案
#1
曲体两周半
狂顶一次
狂顶一次
#2
顶上去
#3
曲体五周半,腾空翻转,*下落
顶
再高难度就不行了 :)
顶
再高难度就不行了 :)
#4
uses
SHDocVw, MSHtml, ActiveX
var
E: IHTMLElement;
begin
E := (WebBrowser1.Document as IHTMLDocument2).elementFromPoint(Mouse.CursorPos.X, Mouse.CursorPos.Y);
E := (WebBrowser1.Document as IHTMLDocument2).elementFromPoint(100, 100);
Label1.Caption := E.title;
Label1.Caption := E.innerText;
SHDocVw, MSHtml, ActiveX
var
E: IHTMLElement;
begin
E := (WebBrowser1.Document as IHTMLDocument2).elementFromPoint(Mouse.CursorPos.X, Mouse.CursorPos.Y);
E := (WebBrowser1.Document as IHTMLDocument2).elementFromPoint(100, 100);
Label1.Caption := E.title;
Label1.Caption := E.innerText;
#5
你编写一个activeX组件来实现,就很方便.
#6
太巧了,
#7
自己试一下就行了
#8
想借宝地问一个问题,是不是要重写TWebBrowser啊!??
#9
yq3woaini(哈哈镜--学习呢,工作呢,进步呢,纯粹混饭吃呢,没活干去)
谢谢
看来曲体五周半,腾空翻转,*下落还是有效的
我先试试看,如果没问题就给分
谢谢
看来曲体五周半,腾空翻转,*下落还是有效的
我先试试看,如果没问题就给分
#10
关于如何截获鼠标消息,还请高人指点
因为TWebBrowser没有鼠标消息,我先想继承TWebBrowser,再截获消息(WM_MouserOver),但结果不行.
于是采用Application.OnMessage
在没有加载页面的时候可以获得鼠标的消息,但是如果加载页面后,而不能获得鼠标的消息
请教,谢谢
因为TWebBrowser没有鼠标消息,我先想继承TWebBrowser,再截获消息(WM_MouserOver),但结果不行.
于是采用Application.OnMessage
在没有加载页面的时候可以获得鼠标的消息,但是如果加载页面后,而不能获得鼠标的消息
请教,谢谢
#11
已经获得鼠标的位置,并获取的控件的名称,但不知道如何将Screen的Point 转换为 WebBrowser的Mouse Point,试过ScreenToClient不成功
#12
关注。
#13
好,已经初步解决问题
发代码以飨观众
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, OleCtrls, SHDocVw, StdCtrls, MSHTML;
type
TForm1 = class(TForm)
WebBrowser1: TWebBrowser;
procedure FormCreate(Sender: TObject);
procedure WebBrowser1DocumentComplete(Sender: TObject;
const pDisp: IDispatch; var URL: OleVariant);
private
{ Private declarations }
FLoaded: Boolean;
procedure AppMsg(var Msg: TagMsg; var Handled: Boolean);
procedure GetContronl;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.AppMsg(var Msg: TagMsg; var Handled: Boolean);
var
mPoint : TPoint;
begin
if IsChild(WebBrowser1.Handle, Msg.Hwnd) and
(Msg.Message = WM_MOUSEMOVE) and FLoaded then
begin
GetCursorPos(mPoint);
GetContronl;
//PopupMenu1.Popup(mPoint.X, mPoint.Y);
Handled:=True;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
FLoaded := False;
WebBrowser1.Navigate('http://www.kitop.com');
Application.OnMessage := AppMsg;
end;
procedure TForm1.GetContronl;
var
E: IHTMLElement;
tmpStr: String;
myPoint: TPoint;
begin
myPoint := Mouse.CursorPos;
myPoint := WebBrowser1.ScreenToClient(myPoint);
{
myPoint.X := myPoint.X + 100;
myPoint.Y := myPoint.Y + 100;
}
E := (WebBrowser1.Document as IHTMLDocument2).elementFromPoint(myPoint.X, myPoint.Y);
//E := (WebBrowser1.Document as IHTMLDocument2).elementFromPoint(100, 100);
//ShowMessage(E.title);
tmpStr := Format('%s,%s,%s,%s;X:%d;Y:%d',[E.className,E.id,E.tagName,E.innerHTML,
myPoint.X,myPoint.Y]);
Caption := tmpStr;
end;
procedure TForm1.WebBrowser1DocumentComplete(Sender: TObject;
const pDisp: IDispatch; var URL: OleVariant);
begin
FLoaded := True;
end;
end.
qsdnet(我想学编程):可以参考一下
发代码以飨观众
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, OleCtrls, SHDocVw, StdCtrls, MSHTML;
type
TForm1 = class(TForm)
WebBrowser1: TWebBrowser;
procedure FormCreate(Sender: TObject);
procedure WebBrowser1DocumentComplete(Sender: TObject;
const pDisp: IDispatch; var URL: OleVariant);
private
{ Private declarations }
FLoaded: Boolean;
procedure AppMsg(var Msg: TagMsg; var Handled: Boolean);
procedure GetContronl;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.AppMsg(var Msg: TagMsg; var Handled: Boolean);
var
mPoint : TPoint;
begin
if IsChild(WebBrowser1.Handle, Msg.Hwnd) and
(Msg.Message = WM_MOUSEMOVE) and FLoaded then
begin
GetCursorPos(mPoint);
GetContronl;
//PopupMenu1.Popup(mPoint.X, mPoint.Y);
Handled:=True;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
FLoaded := False;
WebBrowser1.Navigate('http://www.kitop.com');
Application.OnMessage := AppMsg;
end;
procedure TForm1.GetContronl;
var
E: IHTMLElement;
tmpStr: String;
myPoint: TPoint;
begin
myPoint := Mouse.CursorPos;
myPoint := WebBrowser1.ScreenToClient(myPoint);
{
myPoint.X := myPoint.X + 100;
myPoint.Y := myPoint.Y + 100;
}
E := (WebBrowser1.Document as IHTMLDocument2).elementFromPoint(myPoint.X, myPoint.Y);
//E := (WebBrowser1.Document as IHTMLDocument2).elementFromPoint(100, 100);
//ShowMessage(E.title);
tmpStr := Format('%s,%s,%s,%s;X:%d;Y:%d',[E.className,E.id,E.tagName,E.innerHTML,
myPoint.X,myPoint.Y]);
Caption := tmpStr;
end;
procedure TForm1.WebBrowser1DocumentComplete(Sender: TObject;
const pDisp: IDispatch; var URL: OleVariant);
begin
FLoaded := True;
end;
end.
qsdnet(我想学编程):可以参考一下
#1
曲体两周半
狂顶一次
狂顶一次
#2
顶上去
#3
曲体五周半,腾空翻转,*下落
顶
再高难度就不行了 :)
顶
再高难度就不行了 :)
#4
uses
SHDocVw, MSHtml, ActiveX
var
E: IHTMLElement;
begin
E := (WebBrowser1.Document as IHTMLDocument2).elementFromPoint(Mouse.CursorPos.X, Mouse.CursorPos.Y);
E := (WebBrowser1.Document as IHTMLDocument2).elementFromPoint(100, 100);
Label1.Caption := E.title;
Label1.Caption := E.innerText;
SHDocVw, MSHtml, ActiveX
var
E: IHTMLElement;
begin
E := (WebBrowser1.Document as IHTMLDocument2).elementFromPoint(Mouse.CursorPos.X, Mouse.CursorPos.Y);
E := (WebBrowser1.Document as IHTMLDocument2).elementFromPoint(100, 100);
Label1.Caption := E.title;
Label1.Caption := E.innerText;
#5
你编写一个activeX组件来实现,就很方便.
#6
太巧了,
#7
自己试一下就行了
#8
想借宝地问一个问题,是不是要重写TWebBrowser啊!??
#9
yq3woaini(哈哈镜--学习呢,工作呢,进步呢,纯粹混饭吃呢,没活干去)
谢谢
看来曲体五周半,腾空翻转,*下落还是有效的
我先试试看,如果没问题就给分
谢谢
看来曲体五周半,腾空翻转,*下落还是有效的
我先试试看,如果没问题就给分
#10
关于如何截获鼠标消息,还请高人指点
因为TWebBrowser没有鼠标消息,我先想继承TWebBrowser,再截获消息(WM_MouserOver),但结果不行.
于是采用Application.OnMessage
在没有加载页面的时候可以获得鼠标的消息,但是如果加载页面后,而不能获得鼠标的消息
请教,谢谢
因为TWebBrowser没有鼠标消息,我先想继承TWebBrowser,再截获消息(WM_MouserOver),但结果不行.
于是采用Application.OnMessage
在没有加载页面的时候可以获得鼠标的消息,但是如果加载页面后,而不能获得鼠标的消息
请教,谢谢
#11
已经获得鼠标的位置,并获取的控件的名称,但不知道如何将Screen的Point 转换为 WebBrowser的Mouse Point,试过ScreenToClient不成功
#12
关注。
#13
好,已经初步解决问题
发代码以飨观众
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, OleCtrls, SHDocVw, StdCtrls, MSHTML;
type
TForm1 = class(TForm)
WebBrowser1: TWebBrowser;
procedure FormCreate(Sender: TObject);
procedure WebBrowser1DocumentComplete(Sender: TObject;
const pDisp: IDispatch; var URL: OleVariant);
private
{ Private declarations }
FLoaded: Boolean;
procedure AppMsg(var Msg: TagMsg; var Handled: Boolean);
procedure GetContronl;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.AppMsg(var Msg: TagMsg; var Handled: Boolean);
var
mPoint : TPoint;
begin
if IsChild(WebBrowser1.Handle, Msg.Hwnd) and
(Msg.Message = WM_MOUSEMOVE) and FLoaded then
begin
GetCursorPos(mPoint);
GetContronl;
//PopupMenu1.Popup(mPoint.X, mPoint.Y);
Handled:=True;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
FLoaded := False;
WebBrowser1.Navigate('http://www.kitop.com');
Application.OnMessage := AppMsg;
end;
procedure TForm1.GetContronl;
var
E: IHTMLElement;
tmpStr: String;
myPoint: TPoint;
begin
myPoint := Mouse.CursorPos;
myPoint := WebBrowser1.ScreenToClient(myPoint);
{
myPoint.X := myPoint.X + 100;
myPoint.Y := myPoint.Y + 100;
}
E := (WebBrowser1.Document as IHTMLDocument2).elementFromPoint(myPoint.X, myPoint.Y);
//E := (WebBrowser1.Document as IHTMLDocument2).elementFromPoint(100, 100);
//ShowMessage(E.title);
tmpStr := Format('%s,%s,%s,%s;X:%d;Y:%d',[E.className,E.id,E.tagName,E.innerHTML,
myPoint.X,myPoint.Y]);
Caption := tmpStr;
end;
procedure TForm1.WebBrowser1DocumentComplete(Sender: TObject;
const pDisp: IDispatch; var URL: OleVariant);
begin
FLoaded := True;
end;
end.
qsdnet(我想学编程):可以参考一下
发代码以飨观众
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, OleCtrls, SHDocVw, StdCtrls, MSHTML;
type
TForm1 = class(TForm)
WebBrowser1: TWebBrowser;
procedure FormCreate(Sender: TObject);
procedure WebBrowser1DocumentComplete(Sender: TObject;
const pDisp: IDispatch; var URL: OleVariant);
private
{ Private declarations }
FLoaded: Boolean;
procedure AppMsg(var Msg: TagMsg; var Handled: Boolean);
procedure GetContronl;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.AppMsg(var Msg: TagMsg; var Handled: Boolean);
var
mPoint : TPoint;
begin
if IsChild(WebBrowser1.Handle, Msg.Hwnd) and
(Msg.Message = WM_MOUSEMOVE) and FLoaded then
begin
GetCursorPos(mPoint);
GetContronl;
//PopupMenu1.Popup(mPoint.X, mPoint.Y);
Handled:=True;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
FLoaded := False;
WebBrowser1.Navigate('http://www.kitop.com');
Application.OnMessage := AppMsg;
end;
procedure TForm1.GetContronl;
var
E: IHTMLElement;
tmpStr: String;
myPoint: TPoint;
begin
myPoint := Mouse.CursorPos;
myPoint := WebBrowser1.ScreenToClient(myPoint);
{
myPoint.X := myPoint.X + 100;
myPoint.Y := myPoint.Y + 100;
}
E := (WebBrowser1.Document as IHTMLDocument2).elementFromPoint(myPoint.X, myPoint.Y);
//E := (WebBrowser1.Document as IHTMLDocument2).elementFromPoint(100, 100);
//ShowMessage(E.title);
tmpStr := Format('%s,%s,%s,%s;X:%d;Y:%d',[E.className,E.id,E.tagName,E.innerHTML,
myPoint.X,myPoint.Y]);
Caption := tmpStr;
end;
procedure TForm1.WebBrowser1DocumentComplete(Sender: TObject;
const pDisp: IDispatch; var URL: OleVariant);
begin
FLoaded := True;
end;
end.
qsdnet(我想学编程):可以参考一下