关于IE插件BHO,网上很多文章,我就不再废话介绍。这玩意可以说是非常危险的一种东西,劫持浏览器,盗取用户密码等都可以做。
比如:《两分钟搭建BHO钩子》http://www.vckbase.com/index.php/wv/1597
再比如:《C#开发BHO插件UrlTrack》http://blog.csdn.net/lee576/article/details/3057820
类似的文章不胜枚举,我在实际使用中发现了几个问题记录下来希望能帮助后来者少走弯路。
1. BeforeNavigate2 not fire
Using C# to create BHO is very simple, but while you following the guide on web, you may found your “BeforeNavigate2” event may not fire/trigger.
That’s because a .NETFramework bug, until 4.5.1 this bug still exist. It has been fix after .NETFramework 4.6
If you can’t use C#, you can also use VB or VC++, many guides on web are using C++ (ATL).
BUT if you can’t use ATL, there also a guide of write BHO in plain C, without ATL and MFC
http://www.codeproject.com/Articles/37044/Writing-a-BHO-in-Plain-C
NOTE: there is a bug of PostData in the guide code, other reader find and give out solution in comments under that artical.
2. Modify PostData
I just want to modify/change the postdata user submit using “BeforeNavigate2”, like this man: http://www.dotnetbbs.com/76634257/
Simple assige true to “Cancel” will stop the page navigate, but assign anything to “PostData” has no effect.
I have tried to call browser.Navigate() inside BeforeNavigate2 handler, it does work, and will cause continuly invoke BeforeNavigate2.
[To be continue]