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.

64 lines
1.3 KiB

  1. ///////////////////////////////////////////////////////////
  2. //
  3. //
  4. // lockout.h - Header file for CLockOut
  5. //
  6. //
  7. /*
  8. Before creating any dialog box. Create and instance of this class.
  9. This class will disable all toplevel windows which are in the same process.
  10. This prevents the user from distroying the window while a dialog box is up.
  11. */
  12. #ifndef __LOCKOUT_H__
  13. #define __LOCKOUT_H__
  14. ///////////////////////////////////////////////////////////
  15. //
  16. // constants
  17. //
  18. const int c_MaxWindows = 256 ;
  19. ///////////////////////////////////////////////////////////
  20. //
  21. //
  22. class CLockOut
  23. {
  24. public:
  25. // Construction
  26. CLockOut() ;
  27. virtual ~CLockOut() ;
  28. // Main function.
  29. void LockOut(HWND hwndOwner) ;
  30. // Enable the windows.
  31. void Unlock() ;
  32. //--- Callbacks
  33. private:
  34. // Member callback
  35. BOOL EnumWindowProc(HWND hwnd) ;
  36. // Static callback
  37. static BOOL CALLBACK s_EnumWindowProc(HWND hwnd, LPARAM lparam) ;
  38. //--- Member Variables.
  39. private:
  40. // Array which holds the disabled top level windows.
  41. HWND m_HwndDisabled[c_MaxWindows] ; //TODO: This array needs to grow.
  42. // Status flag
  43. bool m_bLocked ;
  44. //--- Variables used in the EnumWindows Proc.
  45. // Number of windows disabled.
  46. int m_CountDisabled ;
  47. // The process id of the dialogs app.
  48. DWORD m_ProcessId ;
  49. };
  50. #endif // __LOCKOUT_H__