良い一日。
FireBreathでプラグインを書いています。C ++の知識が不足しているため、小さな問題が発生しました。以下のコードを参照してください。
なぜ関数FB::PluginWindowWin::getBrowserHWND()
が返されるのか理解できませんが、関数は機能HWND
したくないのです。HWND
GetWindowRect(hWnd, &rect)
コンパイラFB
はから下線を引きFB::PluginWindowWin::getBrowserHWND()
、「メンバーの非静的リンクはオブジェクトを設定するのではなく指定する必要がある」と言っています(これは私の翻訳です。メッセージはロシア語ですが、それでも同じ意味があると思います)
このエラーが発生しました:
Error C2352 FB::PluginWindowWin::getBrowserHWND:illegal call of non-static member function
コード:
TestPlugin.cpp
#include "Win/PluginWindowWin.h"
#include "JSObject.h"
#include "variant_list.h"
#include "DOM/Document.h"
#include "global/config.h"
#include <Windows.h>
#include "TestPluginAPI.h"
///////My Functions////////
FB::variant PosTest()
{
RECT rect;
HWND hWnd;
hWnd = FB::PluginWindowWin::getBrowserHWND();
if(GetWindowRect(hWnd, &rect))
{
int width = rect.right - rect.left;
int height = rect.bottom - rect.top;
int left = rect.left;
return left;
}
}
TestPlugin.h
#include "Win/PluginWindowWin.h"
#include <string>
#include <sstream>
#include <boost/weak_ptr.hpp>
#include "JSAPIAuto.h"
#include "BrowserHost.h"
#include "TestPlugin.h"
#include <Windows.h>
/////Declarations/////
//Rect
BOOL WINAPI GetWindowRect(HWND hWnd, LPRECT lpRect);
//Pos Test
FB::variant PosTest();