LRESULT CALLBACK TApp::WinProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { TApp *app = TApp::GetApp(); TWin *win = app->SearchWnd(hWnd); if (win) return win->WinProc(uMsg, wParam, lParam); if ((win = app->preWnd)) { app->preWnd = NULL; app->AddWinByWnd(win, hWnd); return win->WinProc(uMsg, wParam, lParam); } return ::DefWindowProc(hWnd, uMsg, wParam, lParam); }
LRESULT CALLBACK TApp::WinProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { TApp *app = TApp::GetApp(); TWin *win = app->SearchWnd(hWnd); LRESULT ret = 0; if (win) { ret = win->WinProc(uMsg, wParam, lParam); } else if ((win = app->preWnd)) { app->preWnd = NULL; app->AddWinByWnd(win, hWnd); ret = win->WinProc(uMsg, wParam, lParam); } else { ret = ::DefWindowProcW(hWnd, uMsg, wParam, lParam); } if (uMsg == WM_DESTROY && app->mainWnd && hWnd == app->mainWnd->hWnd) { ::PostQuitMessage(app->result); } return ret; }