- Visual C++源码
- Visual Basic源码
- C++ Builder源码
- Java源码
- Delphi源码
- C/C++源码
- PHP源码
- Perl源码
- Python源码
- Asm源码
- Pascal源码
- Borland C++源码
- Others源码
- SQL源码
- VBScript源码
- JavaScript源码
- ASP/ASPX源码
- C#源码
- Flash/ActionScript源码
- matlab源码
- PowerBuilder源码
- LabView源码
- Flex源码
- MathCAD源码
- VBA源码
- IDL源码
- Lisp/Scheme源码
- VHDL源码
- Objective-C源码
- Fortran源码
- tcl/tk源码
- QT源码
Subclass.h
资源名称:酒店管理系统源代码.rar [点击查看]
上传用户:czfddz
上传日期:2013-03-20
资源大小:1517k
文件大小:2k
源码类别:
酒店行业
开发平台:
C/C++
- ////////////////////////////////////////////////////////////////
- // VCKBASE -- August 2000
- // Compiles with Visual C++ 6.0, runs on Windows 98 and probably NT too.
- //
- #ifndef _SUBCLASSW_H
- #define _SUBCLASSW_H
- //////////////////
- // Generic class to hook messages on behalf of a CWnd.
- // Once hooked, all messages go to CSubclassWnd::WindowProc before going
- // to the window. Specific subclasses can trap messages and do something.
- //
- // To use:
- //
- // * Derive a class from CSubclassWnd.
- //
- // * Override CSubclassWnd::WindowProc to handle messages. Make sure you call
- // CSubclassWnd::WindowProc if you don't handle the message, or your
- // window will never get messages. If you write seperate message handlers,
- // you can call Default() to pass the message to the window.
- //
- // * Instantiate your derived class somewhere and call HookWindow(pWnd)
- // to hook your window, AFTER it has been created.
- // To unhook, call Unhook or HookWindow(NULL).
- //
- // This is a very important class, crucial to many of the widgets Window
- // widgets implemented in PixieLib. To see how it works, look at the HOOK
- // sample program.
- //
- class CSubclassWnd : public CObject {
- public:
- CSubclassWnd();
- ~CSubclassWnd();
- // Subclass a window. Hook(NULL) to unhook (automatic on WM_NCDESTROY)
- BOOL HookWindow(HWND hwnd);
- BOOL HookWindow(CWnd* pWnd) { return HookWindow(pWnd->GetSafeHwnd()); }
- void Unhook() { HookWindow((HWND)NULL); }
- BOOL IsHooked() { return m_hWnd!=NULL; }
- friend LRESULT CALLBACK HookWndProc(HWND, UINT, WPARAM, LPARAM);
- friend class CSubclassWndMap;
- virtual LRESULT WindowProc(UINT msg, WPARAM wp, LPARAM lp);
- LRESULT Default(); // call this at the end of handler fns
- #ifdef _DEBUG
- virtual void AssertValid() const;
- virtual void Dump(CDumpContext& dc) const;
- #endif
- protected:
- HWND m_hWnd; // the window hooked
- WNDPROC m_pOldWndProc; // ..and original window proc
- CSubclassWnd* m_pNext; // next in chain of hooks for this window
- DECLARE_DYNAMIC(CSubclassWnd);
- };
- #endif // _SUBCLASSW_H