XTPSoundManager.h
上传用户:szled88
上传日期:2015-04-09
资源大小:43957k
文件大小:5k
源码类别:

对话框与窗口

开发平台:

Visual C++

  1. // XTPSoundManager.h : interface for the CXTPSoundManager class.
  2. //
  3. // This file is a part of the XTREME COMMANDBARS MFC class library.
  4. // (c)1998-2008 Codejock Software, All Rights Reserved.
  5. //
  6. // THIS SOURCE FILE IS THE PROPERTY OF CODEJOCK SOFTWARE AND IS NOT TO BE
  7. // RE-DISTRIBUTED BY ANY MEANS WHATSOEVER WITHOUT THE EXPRESSED WRITTEN
  8. // CONSENT OF CODEJOCK SOFTWARE.
  9. //
  10. // THIS SOURCE CODE CAN ONLY BE USED UNDER THE TERMS AND CONDITIONS OUTLINED
  11. // IN THE XTREME TOOLKIT PRO LICENSE AGREEMENT. CODEJOCK SOFTWARE GRANTS TO
  12. // YOU (ONE SOFTWARE DEVELOPER) THE LIMITED RIGHT TO USE THIS SOFTWARE ON A
  13. // SINGLE COMPUTER.
  14. //
  15. // CONTACT INFORMATION:
  16. // support@codejock.com
  17. // http://www.codejock.com
  18. //
  19. /////////////////////////////////////////////////////////////////////////////
  20. //{{AFX_CODEJOCK_PRIVATE
  21. #if !defined(__XTPSOUNDMANAGER_H__)
  22. #define __XTPSOUNDMANAGER_H__
  23. //}}AFX_CODEJOCK_PRIVATE
  24. #if _MSC_VER >= 1000
  25. #pragma once
  26. #endif // _MSC_VER >= 1000
  27. //-----------------------------------------------------------------------
  28. // Summary:
  29. //     Enumeration used to play system sound.
  30. // Example:
  31. //     <code>XTPSoundManager()->PlaySystemSound(xtpSoundMenuCommand);</code>
  32. // See Also: CXTPSoundManager
  33. //
  34. // <KEYWORDS xtpSoundNone, xtpSoundMenuCommand, xtpSoundMenuPopup>
  35. //-----------------------------------------------------------------------
  36. enum XTPSoundManagerState
  37. {
  38. xtpSoundNone,           // No Sound (default)
  39. xtpSoundMenuCommand,    // Menu command system sound
  40. xtpSoundMenuPopup,      // Menu popup system sound
  41. };
  42. //===========================================================================
  43. // Summary:
  44. //     CXTPSoundManager is standalone class. It used to play system sound.
  45. // See Also: XTPSoundManagerState, XTPSoundManager
  46. //===========================================================================
  47. class _XTP_EXT_CLASS CXTPSoundManager
  48. {
  49. friend _XTP_EXT_CLASS CXTPSoundManager* AFX_CDECL XTPSoundManager();
  50. //-------------------------------------------------------------------------
  51. // Summary:
  52. //     Constructs a CXTPSoundManager object.
  53. //-------------------------------------------------------------------------
  54. CXTPSoundManager();
  55. public:
  56. //-------------------------------------------------------------------------
  57. // Summary:
  58. //     Destroys a CXTPSoundManager object, handles cleanup and deallocation
  59. //-------------------------------------------------------------------------
  60. ~CXTPSoundManager();
  61. //-----------------------------------------------------------------------
  62. // Summary:
  63. //     Call this method to play system sound
  64. // Parameters:
  65. //     state - System sound to play. Can be any of the values listed in
  66. //             the remarks section.
  67. // Remarks:
  68. //     State parameter can be one of the following:
  69. //     * <b>xtpSoundMenuCommand</b> Play menu command system sound
  70. //     * <b>xtpSoundMenuPopup</b> Play menu popup system sound
  71. //-----------------------------------------------------------------------
  72. void PlaySystemSound(XTPSoundManagerState state);
  73. //-----------------------------------------------------------------------
  74. // Summary:
  75. //     Call this method to disable all system sounds for application
  76. // Parameters:
  77. //     bEnable - FALSE to disable system sounds.
  78. // Remarks:
  79. //     Call this method to force system settings and disable all sounds.
  80. //-----------------------------------------------------------------------
  81. void EnableSystemSounds(BOOL bEnable);
  82. //-------------------------------------------------------------------------
  83. // Summary:
  84. //     This method is called to stop all sounds and terminate sound thread.
  85. //-------------------------------------------------------------------------
  86. void StopThread();
  87. private:
  88. void StartThread();
  89. static DWORD WINAPI SoundThreadProc(LPVOID);
  90. private:
  91. XTPSoundManagerState m_soundState;
  92. BOOL m_bSystemSounds;
  93. HANDLE m_hThread;
  94. BOOL m_bTerminate;
  95. };
  96. //---------------------------------------------------------------------------
  97. // Summary:
  98. //     Call this function to access CXTPSoundManager members.
  99. //     Since this class is designed as a single instance object you can
  100. //     only access version info through this method. You <b>cannot</b>
  101. //     directly instantiate an object of type CXTPSoundManager.
  102. // Example:
  103. //     <code>XTPSoundManager()->PlaySystemSound(xtpSoundMenuCommand);</code>
  104. //---------------------------------------------------------------------------
  105. _XTP_EXT_CLASS CXTPSoundManager* AFX_CDECL XTPSoundManager();
  106. #endif //#if !defined(__XTPSOUNDMANAGER_H__)