简体   繁体   English

在Internet Explorer_Server(IE9)中处理Windows消息

[英]Processing windows messages in Internet Explorer_Server (IE9)

I'm developing a windowless plugin using Firebreath and I want to catch a particular message for further processing, I'm able to do it so but the rest of the messages are "lost" I think. 我正在使用Firebreath开发一个无窗口的插件,我想捕获特定的消息以进行进一步处理,我能够做到这一点,但我认为其余消息“丢失”了。

I have this code to hook the messages loop: 我有以下代码来钩住消息循环:

bool myPlugin::onWindowAttached(FB::AttachedEvent *evt, FB::PluginWindow* pluginwin)
{
    FB::PluginWindowlessWin* win = dynamic_cast<FB::PluginWindowlessWin*>(pluginwin);

    FBLOG_INFO("", win->getHWND()); //getHWND returns the HWND of the Internet Explorer_Server window (get by using Spy++)

    SubclassWindow(win->getHWND(), (WNDPROC)&myPlugin::WndProc);
    return true;
}

And this is the processing function: 这是处理功能:

LRESULT CALLBACK myPlugin::WndProc(HWND hWindow, UINT msg, WPARAM wParam, LPARAM lParam)
{
    switch (msg) {
        case (WM_ERASEBKGND):           
            return 1;     
    }   
    return DefWindowProc(hWindow, msg, wParam, lParam);
}

This works as expected on IE9 (I'm doing this because I have some problems while repainting an image), but the click message is not processed nor any of the other messages; 这在IE9上可以按预期工作(我这样做是因为在重新绘制图像时遇到一些问题),但是单击消息或其他任何消息均未得到处理。 so if a button is present in the same page as my plugin, it won't be clickable. 因此,如果某个按钮与我的插件位于同一页面中,则该按钮将不可点击。

I'm running IE9 as a single process. 我将IE9作为单个进程运行。

Any help is appreciated. 任何帮助表示赞赏。

Thanks! 谢谢!

You're not calling the previous HWND's wndproc. 您没有调用以前的HWND的wndproc。 Universally calling DefWindowProc() is not correct. 普遍调用DefWindowProc()是不正确的。 When you subclass an HWND, you need to get the address of the old wndproc and pass messages you don't handle to it, not DefWindowProc(). 当您将HWND子类化时,您需要获取旧的wndproc的地址,并将不处理的消息传递给它,而不是DefWindowProc()。

I'm not sure how to do that firebreath / ATL. 我不确定如何进行喷火/ ATL。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM