firebreathを使用してNPAPIプラグインを開発しています。私はゲームデバイスに統合するためにサードパーティ製のDLLを使用しています。デバイスへの入力は、デバイスにチャネルを開いている間に登録されたメッセージ専用ウィンドウ(HWND)を通じてプラグインに伝播されます。メッセージ専用ウィンドウハンドルにCustomWndProcを使用したコールバック
最初に、デバイスドライバとのハンドシェイク、 ハンドシェイク(HWND、...)、その後、ユーザー入力時にCustomWinProc()に対してコールバックが行われ、通知されます。
Iでし以下、WIN-CustomCallbackHandler.h下ヘッダー& CPPファイル-Created 、#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が通常のプラグインのイベントのために数回呼び出されることなく、デバイスによって生成されたイベントは、available.Iメッセージウィンドウの別のインスタンスが渡されると信じていません見ることができたデバッグする場合dllに。
- PluginWindowWinのハンドルを取得するにはどうすればよいですか?
- CustomCallbackHandlerでコールバックを受け取った場合、どのようにカスタムsendEvent()を生成しますか?
お手数をおかけしますようお願い申し上げます。
私はJava開発者であり、C++プログラミングの経験は豊富です。私は何か根本的なものが欠けていると思う。何をしたい
- 私はPluginWindowWinをサブクラス化しようとしていますか? - または - RegisterClassとCreateWindowを呼び出すことによって、この目的のための完全な新しいクラスのメッセージ専用ウィンドウを作成する必要がありますか? – Yeshvanthni
最初は別のメッセージ専用ウィンドウを作成し、ブログを読んだ後にプラグインウィンドウを拡張することが最善の方法だと思っていました。助言がありますか? – Yeshvanthni