Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

95 lines
2.2 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1994.
  5. //
  6. // File: cwindow.h
  7. //
  8. // Contents: definition of a virtual window class
  9. //
  10. // Classes: CHlprWindow
  11. //
  12. // Functions: WindowProc
  13. //
  14. // History: 4-12-94 stevebl Created
  15. //
  16. //----------------------------------------------------------------------------
  17. #ifndef __CWINDOW_H__
  18. #define __CWINDOW_H__
  19. #include <windows.h>
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23. LRESULT CALLBACK WindowProc(
  24. HWND hwnd,
  25. UINT uMsg,
  26. WPARAM wParam,
  27. LPARAM lParam);
  28. #ifdef __cplusplus
  29. }
  30. //+---------------------------------------------------------------------------
  31. //
  32. // Class: CHlprWindow
  33. //
  34. // Purpose: virtual base class for wrapping a window
  35. //
  36. // Interface: Create -- analagous to Windows' CreateWindow function
  37. // WindowProc -- pure virtual WindowProc for the window
  38. // ~CHlprWindow -- destructor
  39. // CHlprWindow -- constructor
  40. //
  41. // History: 4-12-94 stevebl Created
  42. //
  43. // Notes: This class allows a window to be cleanly wrapped in a
  44. // c++ class. Specifically, it provides a way for a c++ class
  45. // to use one of its methods as a WindowProc, giving it a "this"
  46. // pointer and allowing it to have direct access to all of its
  47. // private members.
  48. //
  49. //----------------------------------------------------------------------------
  50. class CHlprWindow
  51. {
  52. public:
  53. HWND Create(
  54. LPCTSTR lpszClassName,
  55. LPCTSTR lpszWindowName,
  56. DWORD dwStyle,
  57. int x,
  58. int y,
  59. int nWidth,
  60. int nHeight,
  61. HWND hwndParent,
  62. HMENU hmenu,
  63. HINSTANCE hinst);
  64. virtual LRESULT WindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam) = 0;
  65. virtual ~CHlprWindow(){};
  66. HWND GetHwnd(void)
  67. {
  68. return(_hwnd);
  69. }
  70. CHlprWindow()
  71. {
  72. _hwnd = NULL;
  73. _hInstance = NULL;
  74. };
  75. protected:
  76. friend LRESULT CALLBACK ::WindowProc(
  77. HWND hwnd,
  78. UINT uMsg,
  79. WPARAM wParam,
  80. LPARAM lParam);
  81. HWND _hwnd;
  82. HINSTANCE _hInstance;
  83. };
  84. #endif
  85. #endif //__CWINDOW_H__