mshtml HTMLFormElement事件 [英] mshtml HTMLFormElement events

查看:62
本文介绍了mshtml HTMLFormElement事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

dev。环境:VS.Net2003 / C#


我有一个带有Web浏览器控件的Windows窗体应用程序。我需要

捕获文档中表单的onsubmit事件,以便获取值并记录它们。


我试过这个:


1.

this.current_page = this.mydoc.Document as mshtml.HTMLDocumentClass;


if(this.current_page!= null)

{

mshtml.IHTMLElementCollection _forms = this.current_page.forms;


foreach(_forms中的mshtml.IHTMLFormElement _form)

{

((mshtml.HTMLFormElementEvents2_Event)_form).onsub mit + =

new mshtml.HTMLFormElementEvents2_onsubmitEventHandler

(MyDoc_onsubmit);

}

}


2.

<相同,只是差异。 foreach>

foreach(mshtml.HTMLFormElementClass _form in this.forms)

{

_form.HTMLFormElementEvents2_Event_onsubmit + =

new mshtml.HTMLFormElementEvents2_onsubmitEventHandler

(MyDoc_onsubmit);

.....


在codeproject上有2篇文章。 com,他们也不工作。


而且......没有成功。没有任何例外情况,一切都过去了,但是在页面上的表单子页面被阻止之后,即使是提交按钮

也不起作用。


我试图绕过这个并使用

浏览器的BeforeNavigate2事件(它可以工作)并检查是否有postdata。但是在那种情况下

我会松散具有GET方法的表格。


请,任何帮助都将受到高度赞赏。


谢谢

Sunny

Hi all,
dev. env.: VS.Net2003/C#

I have a windows form application with web browser control. I need to
capture the onsubmit event of the forms in the document in order to get
the values and log them.

I have tried this:

1.

this.current_page = this.mydoc.Document as mshtml.HTMLDocumentClass;

if (this.current_page != null)
{
mshtml.IHTMLElementCollection _forms = this.current_page.forms;

foreach (mshtml.IHTMLFormElement _form in _forms)
{
((mshtml.HTMLFormElementEvents2_Event)_form).onsub mit +=
new mshtml.HTMLFormElementEvents2_onsubmitEventHandler
(MyDoc_onsubmit);
}
}

2.
<same, just diff. foreach>
foreach (mshtml.HTMLFormElementClass _form in this.forms)
{
_form.HTMLFormElementEvents2_Event_onsubmit +=
new mshtml.HTMLFormElementEvents2_onsubmitEventHandler
(MyDoc_onsubmit);
.....

And there are 2 articles on codeproject.com, they do not work also.

And ... no success. There is no exceprions, everything passes, but after
that the form submition on the page is blocked, even the submit button
does not work.

I have tried to go around this and to use BeforeNavigate2 event of the
browser (it works) and to examine if there is postdata. But in that case
I''ll loose forms which has GET method.

Please, any help will be highly appreciated.

Thanks
Sunny

推荐答案



Hi Sunny,


您可以在onsubmitEventHandler中设置断点,以查找是否已调用此方法




祝你好运,

Jeffrey Tan

Microsoft在线合作伙伴支持

安全! - www.microsoft.com/security

此帖子按原样提供没有保证,也没有赋予任何权利。


Hi Sunny,

You can set break point in the onsubmitEventHandler to find if this method
was called.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.


你好Jeffrey,


感谢您的建议。我发布之前已经这样做了。我是

说它没有被叫,我的意思是。


谢谢

Sunny


在文章< 0f ************** @ cpmsftngxa07.phx.gbl>中,v-
je *** @ online.microsoft.com 说...
Hi Jeffrey,

Thanks for the suggestion. I have already done this before I post. I''m
stating that it is not called, and I mean it.

Thanks
Sunny

In article <0f**************@cpmsftngxa07.phx.gbl>, v-
je***@online.microsoft.com says...

嗨Sunny,
您可以在onsubmitEventHandler中设置断点,以查找是否已调用此方法。

此致,Jeffrey Tan
Microsoft在线合作伙伴支持
安全! - www.microsoft.com/security
此帖子提供就像没有保证,也没有授予任何权利。

Hi Sunny,

You can set break point in the onsubmitEventHandler to find if this method
was called.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.





阳光明媚,


是的,我已经尝试过您的解决方案2.我没有在您的代码中发现任何错误。

我将对此进行一些搜索。我会尽快回复你。

感谢您的理解。


祝你好运,

Jeffrey Tan

Microsoft在线合作伙伴支持

安全! - www.microsoft.com/security

此帖子按原样提供没有保证,也没有赋予任何权利。


Hi Sunny,

Yes, I have tried your solution 2. I did not find any error in your code.
I will do some search into this. I will reply you ASAP.
Thanks for your understanding.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.


这篇关于mshtml HTMLFormElement事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆