おい2です。
今、クラスを使ってウインドウを作っていますが、
ウインドウを生成するとき、
//w1.h
#include windows.h
class w1
{
private:
char name[41];
HWND hWnd;
MSG msg;
WNDCLASS myProg;
HINSTANCE hInst;
HINSTANCE hPreI;
LPSTR lpszCmd;
int nCmd;
public:
w1(char s[],HINSTANCE hInstance, HINSTANCE hPreInst,LPSTR lpszCmdLine, int
nCmdShow);
int wc();
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
};
でLRESULT CALLBACK WndProcをクラス内のウインドウ生成プログラムの下のパラメータ
int w1::wc()
{
…(プログラム省略)
myProg.lpfnWndProc =WndProc;
…(プログラム省略)
}
にいれると、
error C2440: '=' : 'long (__stdcall w1::*)(struct HWND__ *,unsigned
int,unsigned int,long)' から 'long (__stdcall *)(struct HWND__ *,unsigned
int,unsigned int,long)' に変換することはできません。(新しい動作 ;
ヘルプを参照)
とでてできません。クラス内でのWndProcはどう扱えばよいのでしょうか?
よろしくお願いします。
w1::WndProcを静的メンバ関数にしてみて下さい。
ありがとうございます。
(
static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
)
にしたら動きました