导航
  • 主页
  • VC综合技术
  • 互联网技术
  • MFC AppLauncher
  • .NET 技术
  • 界面
  • 进程
  • 算法
  • 硬件/系统
  • 数据库
  • VC++技术资源

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这部份源代码详细阅读,希望有经验的专业人士指点个方向.
...全文
421 点赞 收藏 20
写回复
20 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
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/
回复
发动态
发帖子
VC/MFC
创建于2007-09-28

1.5w+

社区成员

VC/MFC相关问题讨论
申请成为版主
社区公告

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