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.

83 lines
2.6 KiB

  1. /*******************************************************************************
  2. *
  3. * (C) COPYRIGHT MICROSOFT CORPORATION, 1998
  4. *
  5. * TITLE: SSHNDLER.H
  6. *
  7. * VERSION: 1.0
  8. *
  9. * AUTHOR: ShaunIv
  10. *
  11. * DATE: 12/4/1999
  12. *
  13. * DESCRIPTION:
  14. *
  15. *******************************************************************************/
  16. #ifndef __SSHNDLER_H_INCLUDED
  17. #define __SSHNDLER_H_INCLUDED
  18. #include <windows.h>
  19. #include "imagescr.h"
  20. #include "extimer.h"
  21. #include "simstr.h"
  22. #include "findthrd.h"
  23. //
  24. // We will shuffle the list every [SHUFFLE_INTERVAL] images until we are done gathering files.
  25. //
  26. #define SHUFFLE_INTERVAL 50
  27. //
  28. // To decrease the tendency to see the same image first, we will try to vary the image that
  29. // causes the screensaver to be started to a random image index less than this number
  30. //
  31. #define MAX_START_IMAGE 20
  32. //
  33. // Number of ms to wait before starting up the screensaver timers
  34. // in case we don't find an image before this timer runs.
  35. //
  36. #define BACKUP_START_TIMER_PERIOD 5000
  37. class CScreenSaverHandler
  38. {
  39. private:
  40. CImageScreenSaver *m_pImageScreenSaver;
  41. HINSTANCE m_hInstance;
  42. CSimpleString m_strRegistryPath;
  43. HWND m_hWnd;
  44. UINT m_nPaintTimerId;
  45. UINT m_nChangeTimerId;
  46. UINT m_nBackupStartTimerId;
  47. UINT m_nBackupStartTimerPeriod;
  48. UINT m_nFindNotifyMessage;
  49. bool m_bPaused;
  50. CExclusiveTimer m_Timer;
  51. HANDLE m_hFindThread;
  52. HANDLE m_hFindCancel;
  53. bool m_bScreensaverStarted;
  54. int m_nStartImage;
  55. int m_nShuffleInterval;
  56. CRandomNumberGen m_Random;
  57. private:
  58. // No implementation
  59. CScreenSaverHandler(void);
  60. CScreenSaverHandler( const CScreenSaverHandler & );
  61. CScreenSaverHandler &operator=( const CScreenSaverHandler & );
  62. public:
  63. void Initialize(void);
  64. CScreenSaverHandler( HWND hWnd, UINT nFindNotifyMessage, UINT nPaintTimer, UINT nChangeTimer, UINT nBackupStartTimer, LPCTSTR szRegistryPath, HINSTANCE hInstance );
  65. ~CScreenSaverHandler(void);
  66. // Message handlers
  67. bool HandleKeyboardMessage( UINT nMessage, WPARAM nVirtkey );
  68. void HandleConfigChanged(void);
  69. void HandleTimer( WPARAM nEvent );
  70. void HandlePaint(void);
  71. void HandleFindFile( CFoundFileMessageData *pFoundFileMessageData );
  72. };
  73. #endif // __SSHNDLER_H_INCLUDED