So I just about have my basic window class finished. I have it down to 1 unresolved external error. I cannot for the life of me trace it down. Here is what I have so far.
MyWindowClass.hMyWindowClass.cppCode:#ifndef MYWINDOWCLASS_H_INCLUDED #define MYWINDOWCLASS_H_INCLUDED class CBaseWindow; typedef std::map<HWND, CBaseWindow*> hWndMap; class CBaseWindow { public: CBaseWindow() { } virtual ~CBaseWindow() { } static LRESULT CALLBACK GlobalWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); virtual LRESULT CALLBACK InstanceWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); void Attach(HWND h, CBaseWindow *pClass) { m_ThisMap[h] = pClass; } static hWndMap m_ThisMap; }; class CWindow : public CBaseWindow { public: CWindow(); ~CWindow() { } bool Create(HINSTANCE hInstance, int nCmdShow, LPCSTR szClassName, LPCSTR szWindowName); int Run(); LRESULT CALLBACK InstanceWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); BOOL NavPaneDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); BOOL ViewPaneDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); private: WNDCLASSEX m_wc; HWND m_hwnd; MSG m_Msg; HINSTANCE m_hInstance; LPCSTR m_ClassName; LPCSTR m_WindowName; HWND m_hNavPane; HWND m_hViewPane; }; #endif // MYWINDOWCLASS_H_INCLUDEDmain.cppCode:#include "stdafx.h" hWndMap CBaseWindow::m_ThisMap; LRESULT CBaseWindow::GlobalWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { hWndMap::iterator it = m_ThisMap.find(hWnd); if (it != m_ThisMap.end() ) { CWindow *pClass = (CWindow*)it->second; return pClass->InstanceWndProc(hWnd, msg, wParam, lParam); } return DefWindowProc(hWnd, msg, wParam, lParam); } LRESULT CWindow::InstanceWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch(msg) { // Menu Bar Commands case WM_COMMAND: { switch(LOWORD(wParam) ) { // Select Menubar-File-Exit case ID_FILE_EXIT: { PostMessage(hwnd, WM_CLOSE, 0, 0); } break; } } case WM_CLOSE: { DestroyWindow(hwnd); } break; case WM_DESTROY: { PostQuitMessage(0); } break; default: { return DefWindowProc(hwnd, msg, wParam, lParam); } } return 0; } CWindow::CWindow() { m_hwnd = NULL; m_hNavPane = NULL; m_hViewPane = NULL; } bool CWindow::Create(HINSTANCE hInstance, int nCmdShow, LPCSTR szClassName, LPCSTR szWindowName) { m_hInstance = hInstance; m_ClassName = (LPCSTR)szClassName; m_WindowName = (LPCSTR)szWindowName; // Register the Window Class m_wc.cbSize = sizeof(WNDCLASSEX); m_wc.style = 0; m_wc.lpfnWndProc = GlobalWndProc; m_wc.cbClsExtra = 0; m_wc.cbWndExtra = 0; m_wc.hInstance = hInstance; m_wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); m_wc.hCursor = LoadCursor(NULL, IDC_ARROW); m_wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); m_wc.lpszMenuName = MAKEINTRESOURCE(IDR_MYMENU); m_wc.lpszClassName = m_ClassName; m_wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION); if(!RegisterClassEx(&m_wc)) { SHOWERROR("Window Registration Failed!"); return false; } // Create the window m_hwnd = CreateWindowEx(WS_EX_CLIENTEDGE, m_ClassName, m_WindowName, WS_MAXIMIZE | WS_OVERLAPPEDWINDOW | WS_VSCROLL | WS_HSCROLL, 0,0,1280,1020, NULL, NULL, m_hInstance, NULL); if(m_hwnd == NULL) { SHOWERROR("Window Creation Failed!"); return false; } Attach(m_hwnd, this); ShowWindow(m_hwnd, nCmdShow); UpdateWindow(m_hwnd); return true; } int CWindow::Run() { while(GetMessage(&m_Msg, NULL, 0, 0) > 0) { TranslateMessage(&m_Msg); DispatchMessage(&m_Msg); } return m_Msg.wParam; }and the error I'm getting isCode:#include "stdafx.h" int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { CWindow *pWindow = new CWindow(); // Create the Window int msg; if (pWindow->Create(hInstance, nCmdShow, "MainWindowClass", "My Window") ) { // Run the application (start the message loop) msg = pWindow->Run(); } // Clean up resources if(pWindow) { delete pWindow; pWindow = NULL; } return msg; }
OK, so what am I missing?Code:unresolved external symbol "public: virtual long __stdcall CBaseWindow::InstanceWndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?InstanceWndProc@CBaseWindow@@UAGJPAUHWND__@@IIJ@Z)



LinkBack URL
About LinkBacks



