Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/neo4j/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Winapi 对仅消息窗口句柄使用CustomWndProc进行回调_Winapi_Npapi_Firebreath - Fatal编程技术网

Winapi 对仅消息窗口句柄使用CustomWndProc进行回调

Winapi 对仅消息窗口句柄使用CustomWndProc进行回调,winapi,npapi,firebreath,Winapi,Npapi,Firebreath,我正在使用firebreath开发一个NPAPI插件。我正在使用第三方dll集成到游戏设备。设备上的输入通过在打开设备通道时注册的消息窗口(HWND)传播到插件 最初,与设备驱动程序握手, 握手(HWND,…),然后在用户输入时,对CustomWinProc()进行回调以通知 我做了以下几件事 -在WIN CustomCallbackHandler.h下创建了一个头文件&CPP文件 #include "Win\PluginWindowWin.h" #include "Win\Wind

我正在使用firebreath开发一个NPAPI插件。我正在使用第三方dll集成到游戏设备。设备上的输入通过在打开设备通道时注册的消息窗口(HWND)传播到插件

最初,与设备驱动程序握手, 握手(HWND,…),然后在用户输入时,对CustomWinProc()进行回调以通知

我做了以下几件事

-在WIN CustomCallbackHandler.h下创建了一个头文件&CPP文件

   #include "Win\PluginWindowWin.h"
   #include "Win\WindowContextWin.h"

    class CustomCallbackHandler : public FB::PluginWindowWin
     {
       public:
     CustomCallbackHandler (const FB::WindowContextWin& ctx);

      protected:
     virtual bool CustomWinProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM   
        lParamm,LRESULT & lRes);
     };
-CustomCallbackHandler.cpp

    [code]
    #include "CustomCallbackHandler.h"
    #include "PluginWindowForwardDecl.h"
    #include "Win\WindowContextWin.h"
    #include "Win\PluginWindowWin.h"

    CustomCallbackHandler::CustomCallbackHandler(const FB::WindowContextWin& ctx) :    
    FB::PluginWindowWin(ctx){
    }

    bool CustomCallbackHandler::CustomWinProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM 
    lParamm,LRESULT & lRes){
    //if WPARAM is something some operation has to be performed.
 return false;
    }
    [/code]
-Factory.cpp-添加了以下方法来覆盖PluginWindowWin

FB::PluginWindowWin* createPluginWindowWin(const FB::WindowContextWin& ctx)
{
    return new CustomCallbackHandler(ctx);

}
-MyFirstPluginAPI.cpp-(自动生成的JSAPIAuto子类)-JS方法

    bool MyFirstPluginAPI::handshake(FB::JSObjectPtr &callback)
     {
        FB::WinMessageWindow window;
        thirdpartymethod(window.getHWND());
     }
现在,当我调试时,我可以看到customcallbackhandler为常规插件事件调用了几次,但是设备生成的事件不可用。我相信消息窗口的另一个实例会传递到dll

-如何获得PluginWindowWin的句柄?
-在CustomCallbackHandler上收到回调后,如何生成自定义sendEvent()

非常感谢你的帮助


我是一个java开发人员,在C++编程方面没有太多的经验。我相信我遗漏了一些基本信息。

您想要的是使用WinMessageWindow:

你不想使用PluginWindowWin;这对于其他事情来说太具体了。WinMessageWindow是专门创建的,用于执行您尝试执行的操作类型,它允许您在包含类上创建winproc处理程序


我最近为了接收WM_DEVICENOTIFY消息而发布;我相信你可以用它作为一个例子来说明类是如何开始的。

-我尝试将PluginWindowWin子类化的方向正确吗?-或者-我应该通过调用RegisterClass和CreateWindow来创建一个全新的消息窗口类吗?最初,我创建了另一组消息窗口,在阅读了一些博客之后,我认为最好通过扩展插件窗口来利用插件窗口。有什么建议吗?