#ifndef _WINDOW_HPP_ #define _WINDOW_HPP_ #include #include class Window : public CursorControl { public: Window(); ~Window(); HWND GetHandle(void)const; int Show(int nCmdShow); void Update(void); #if defined (__SMALL__) || defined (__MEDIUM__) static Window *Window::GetPointer(HWND hWnd); static void Window::SetPointer(HWND hWnd,Window *pWindow); #else static Window *Window::GetPointer(HWND hWnd); static void Window::SetPointer(HWND hWnd,Window *pWindow); #endif void SetHandle(HWND hWnd); virtual long WndProc(UINT message,WPARAM wParam,LPARAM lParam)=0; protected: private: // friend long FAR PASCAL _export WndProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam); __declspec(dllexport) static LONG FAR PASCAL WndProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam); HWND mhWnd; }; inline HWND Window::GetHandle(void)const { if(::IsWindow(mhWnd))return mhWnd; return 0; } inline void Window::SetHandle(HWND hWnd) { mhWnd=hWnd; } inline int Window::Show(int nCmdShow) { if(!GetHandle())return FALSE; return ::ShowWindow(GetHandle(),nCmdShow); } inline void Window::Update(void) { if(!GetHandle())return; ::UpdateWindow(GetHandle()); } #if defined (__SMALL__) || defined (__MEDIUM__) inline Window *Window::GetPointer(HWND hWnd) { return (Window*)GetWindowWord(hWnd,0); } inline void Window::SetPointer(HWND hWnd,Window *pWindow) { SetWindowWord(hWnd,0,(WORD)pWindow); } #else inline Window *Window::GetPointer(HWND hWnd) { return (Window*)::GetWindowLong(hWnd,0); } inline void Window::SetPointer(HWND hWnd,Window *pWindow) { ::SetWindowLong(hWnd,0,(LONG)pWindow); } #endif #endif