Firefox浏览器中的事件获取方法

Zark 2005-12-01 01:30:29
在IE中可通过IE的窗口句柄获得其IWebBrowser2接口,从而达到侦听所有WebBrowser Event的事件的目的.

现在的问题是如何对付Firefox?据网上文章的大致介绍,推测Firefox是不用MS的WebBrowser Control的,但它自有的WebBrowser Control也是一个COM组件.再根据软件开发时尽量兼容的原则,推测Firefox的WebBrowser Control也会"部份"兼容于MS的WebBrowser Control.

由于时间上的限制,无法将Firefox这部份源代码详细阅读,希望有经验的专业人士指点个方向.
...全文
552 20 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
20 条回复
切换为时间正序
请发表友善的回复…
发表回复
Zark 2006-03-11
  • 打赏
  • 举报
回复
时间太长了,看来没有什么可以借鉴的方法了.先结了此帖,日后重开帖讨论.由于没有得到结果,就只按原200分结帖,答应的2000分等下次开帖再分吧.
victorzou 2006-01-14
  • 打赏
  • 举报
回复
mark
pomelowu 2005-12-23
  • 打赏
  • 举报
回复
插不上嘴,帮顶,学习~
Zark 2005-12-09
  • 打赏
  • 举报
回复
I also sent an email to Mr. Adam Lock, asking for his answer on this topic, but I am not very sure about receiving the reply from him. It was recommended by someone on netscape.public.mozilla.browser that Mr. Adam Lock's web pages might be helpful to settle down my question, I decided to write him an email after I read through all the pages on his webstie and did not get any hint.

If I could get his reply that helps to solve the problem, I will post it here to share.


Zark 2005-12-09
  • 打赏
  • 举报
回复
Thanks for link of tutorial on creating plugin

I am still bitterly fighting to build the sample plugin. First, I got the SDK and sample source, when it's compiled, it complained that nspr4.lib was missing, so I checked the SDK lib directory, nothing was there but something called nspr4_s.lib was in bin directory, so I renamed it as nspr4.lib and added an additional lib path to that bin directory. I did something with other serveral libs too. Finally, I made the compiler loved me, but now came the linker who complained the unresolved external, for an example,

xpcomglue.lib(nsGenericFactory.obj) : error LNK2019: unresolved external symbol __imp__PR_AtomicIncrement referenced in function "public: virtual unsigned long __stdcall nsGenericFactory::AddRef(void)" (?AddRef@nsGenericFactory@@UAGKXZ)

This is one of the 3 backbone functions of every coclass, it is so mysterious to me that it is missing, how could that happen? If you had experiences on how it comes, it would be greatly helpful to end my miserable.

For your information, I am learning plugin technology is only to improve the personal ability. Due to the legal restriction, I will not be able to create plugin and then grab the interface pointer. I do appreciate your help to open the door of plugin for me, but if you have had any idea on solving my original problem without creating the plugin, that would be magnificent.

with best regards.

蒋晟 2005-12-08
  • 打赏
  • 举报
回复
A step by step plugin sample can be found at http://www.iosart.com/firefox/xpcom/
You can also search in netscape.public.mozilla.plugins. I guess you can write your own plugin and expose it to the ROT, so other programs can operater the Firefox instance via the plugin.

For the second reference, I used a list of HWNDs to automate the new Explorer.exe instance created by ShellExecute.
hell_wolf 2005-12-08
  • 打赏
  • 举报
回复
up
Zark 2005-12-07
  • 打赏
  • 举报
回复
Thank you for your posting on my question again.

Indeed I like your idea on writing a user defined BHO for Firefox, but unfortunately I do not know how to do it.

After reading your references, I still did not get any idea on it. Your first reference is talking about writing a BHO to registry itself into ROT so that the running IE instance is able to expose IObjectWithSite interface, and it is designed to solve the problem of IE4. In fact, IWebBrowser2 could be easily retrieved from the window handle of running instance of IE6 through WM_HTML_GETOBJECT message, acutually it was the IHTMLDocument2 that was retrieved, but there is on difficult to grab the IWebBrowser2 from it. Your second reference is talking about how to invoke an IE instance and get full control over it by sinking WebBrowser events, I've already handlded all issues over IE, right now what bothers me is how to handle the non-microsoft browsers, as you already know, the firefox is first bird I want to shoot down.

Thank you all the same anyway for helping me to search the possible solutions, even though those references are not targetting on my concerning, but they are still very good for anybody who is reading this post to find any similar solution when they struggle with IE on this topic.

Good luck and take care.
Zark 2005-12-07
  • 打赏
  • 举报
回复
Thank you for your posting on my question again.

Indeed I like your idea on writing a user defined BHO for Firefox, but unfortunately I do not know how to do it.

After reading your references, I still did not get any idea on it. Your first reference is talking about writing a BHO to registry itself into ROT so that the running IE instance is able to expose IObjectWithSite interface, and it is designed to solve the problem of IE4. In fact, IWebBrowser2 could be easily retrieved from the window handle of running instance of IE6 through WM_HTML_GETOBJECT message, acutually it was the IHTMLDocument2 that was retrieved, but there is on difficult to grab the IWebBrowser2 from it. Your second reference is talking about how to invoke an IE instance and get full control over it by sinking WebBrowser events, I've already handlded all issues over IE, right now what bothers me is how to handle the non-microsoft browsers, as you already know, the firefox is first bird I want to shoot down.

Thank you all the same anyway for helping me to search the possible solutions, even though those references are not targetting on my concerning, but they still very good from anybody who is reading this post to find any similar solution to struggle with IE on this topic.

Good luck and take care.
fine10000 2005-12-07
  • 打赏
  • 举报
回复
学习
蒋晟 2005-12-07
  • 打赏
  • 举报
回复
I've heard you can write our own BHO-like Firefox extension. Consider writing a plugin to expose an automation interface.

Reference:
http://www.codeguru.com/Cpp/I-N/ieprogram/article.php/c1239/
http://www.codeproject.com/shell/AutomateShellWindow.asp
hell_wolf 2005-12-06
  • 打赏
  • 举报
回复
up
leechiyang 2005-12-06
  • 打赏
  • 举报
回复
mark一下
38062708 2005-12-06
  • 打赏
  • 举报
回复
真奇怪,平常我在CSDN上回答问题时,总可以看到一群热心的二星和三星,甚至是20分的讨论都看得到他们矫健的身影,可现在都躲到哪里去了,一个也瞧不见,真是奇哉怪也.

=========================================

分是满多的,可是俺们没做过这个,再说蒋老大也已经回答了吗
Zark 2005-12-05
  • 打赏
  • 举报
回复
仍是"云山雾罩",看来不得不去netscape.public.mozilla.builds, netscape.public.mozilla.embedding问了.

真奇怪,平常我在CSDN上回答问题时,总可以看到一群热心的二星和三星,甚至是20分的讨论都看得到他们矫健的身影,可现在都躲到哪里去了,一个也瞧不见,真是奇哉怪也.
WuOu 2005-12-04
  • 打赏
  • 举报
回复
Mark.
蒋晟 2005-12-03
  • 打赏
  • 举报
回复
you can ask your questions in the following newsgroups:

netscape.public.mozilla.builds
netscape.public.mozilla.embedding

But I did not found anything related in the source code.
Zark 2005-12-02
  • 打赏
  • 举报
回复
花了几小时,连上mozilla的CVS服务器,下载了mozilla的源代码,为了下那embedding/browser/activex/src/control结果不得不下了所有的/mozilla,真不懂是怎么回事! 打开后无法编译,原因是make文件的有错误.也罢,不编就不编,直接读代码.

看了几小时,恍惚地明白以下几点:
1. Mozilla的embedding browser是个COM组件.
2. 这组件支持nsIWebBrowser接口,其功用接近IWebBrowser2.
3. 这组件支持DOM,其接口接近于IHTMLDocument2.
4. 如果用CoCreateInstance可以创建browser组件,同时得到nsIWebBrowser,然后sink所有的DWebBrowserEvent.

但原问题仍旧没有解决, 这个nsIWebBrowser是在程序中使用CoCreateInstance主动构建的,但我目前要求是: 在只有Firefox的主窗口句柄(或说firefox.exe的process ID)的情况下,如何才能获取其nsIWebBrowser接口呢? (那个instance可不是我主动建立的)

这个小版的确人数太少,两天过来只有一个回复,还是个URL. 还是移到"基础类"中去,虽有点不够准确,看看能不能来个"众人拾柴火焰高".

Zark 2005-12-01
  • 打赏
  • 举报
回复
多谢馈赠源代码网址,可是"老虎吃天,无法下口",可否指点个思路,或三言,或两语,解释一下mozila的那个control的架构?
蒋晟 2005-12-01
  • 打赏
  • 举报
回复
http://lxr.mozilla.org/mozilla/source/embedding/browser/activex/src/control/

16,548

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • AIGC Browser
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧