WinApi를 사용하여이 win32 프로그램을 작성하려고하는데 다음과 같은 튜토리얼에 문제가있는 것 같습니다.C2440 C++ WinApi에서 LRESULT를 WNDPROC로 변환 할 수 없습니다.
MainWindow.h :
class MainWindow
{
public:
MainWindow(HINSTANCE);
~MainWindow(void);
LRESULT CALLBACK WndProcedure(HWND, UINT, WPARAM, LPARAM);
// [...]
MainWindow.cpp :
MainWindow::MainWindow(HINSTANCE hInstance) : hwnd(0)
{
WNDCLASSEX WndClsEx;
// [...]
WndClsEx.lpfnWndProc = &MainWindow::WndProcedure;
// [...]
}
LRESULT CALLBACK MainWindow::WndProcedure(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
// [...]
}
튜토리얼 말한다 정확하게 내가 서명을 다음 해요 때문에 나는 그러나, MainWindow를 :: WndProcedure 잘못 참조해야
생성자의 lpfnWndProc 줄에 컴파일 타임 오류가 발생합니다.
오류 C2440 : '=': 'LRESULT (__stdcall MainWindow :: *) (HWND, UINT, WPARAM, LPARAM) '에서'WNDPROC '
오류가 표시되는 라인은 무엇입니까? 나는 그것이 당신이 올린 것에 있다고 생각하지 않습니다. – Mat
클래스 메서드에 전달 된 창 메시지를 가져 오는 관용적 인 방법은 Raymond Chens [scratch program] (http://blogs.msdn.com/b/oldnewthing/archive/2005/04/22/410773.aspx)를 참조하십시오 (To 메서드 선언에'static'을 추가 한 후 다음 논리적 인 질문에 답하십시오). – user786653