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.

131 lines
3.2 KiB

  1. /////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1998 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // AtlBaseApp.h
  7. //
  8. // Description:
  9. // Definition of the CBaseApp class.
  10. //
  11. // Author:
  12. // Galen Barbee (galenb) May 21, 1998
  13. //
  14. // Revision History:
  15. //
  16. // Notes:
  17. //
  18. /////////////////////////////////////////////////////////////////////////////
  19. #ifndef __ATLBASEAPP_H_
  20. #define __ATLBASEAPP_H_
  21. /////////////////////////////////////////////////////////////////////////////
  22. // Forward Class Declarations
  23. /////////////////////////////////////////////////////////////////////////////
  24. class CBaseApp;
  25. /////////////////////////////////////////////////////////////////////////////
  26. // External Class Declarations
  27. /////////////////////////////////////////////////////////////////////////////
  28. /////////////////////////////////////////////////////////////////////////////
  29. // Include Files
  30. /////////////////////////////////////////////////////////////////////////////
  31. /////////////////////////////////////////////////////////////////////////////
  32. // Type Definitions
  33. /////////////////////////////////////////////////////////////////////////////
  34. /////////////////////////////////////////////////////////////////////////////
  35. //++
  36. //
  37. // class CBaseApp
  38. //
  39. // Description:
  40. // Base application class. The following functionality is provided:
  41. // -- Help file support.
  42. //
  43. // Inheritance:
  44. // CBaseApp
  45. // CComModule
  46. //
  47. //--
  48. /////////////////////////////////////////////////////////////////////////////
  49. class CBaseApp : public CComModule
  50. {
  51. public:
  52. //
  53. // Construction.
  54. //
  55. // Default constructor
  56. CBaseApp( void )
  57. : m_pszHelpFilePath( NULL )
  58. {
  59. } //*** CBaseApp()
  60. // Destructor
  61. ~CBaseApp( void )
  62. {
  63. delete m_pszHelpFilePath;
  64. } //*** ~CBaseApp()
  65. // Return the path to the help file, generate if necessary
  66. virtual LPCTSTR PszHelpFilePath( void )
  67. {
  68. //
  69. // If no help file path has been specified yet, generate
  70. // it from the module path name.
  71. //
  72. if ( m_pszHelpFilePath == NULL )
  73. {
  74. TCHAR szPath[_MAX_PATH];
  75. TCHAR szDrive[_MAX_PATH]; // not _MAX_DRIVE so we can support larger device names
  76. TCHAR szDir[_MAX_DIR];
  77. //
  78. // Get the path to this module. Split out the drive and
  79. // directory and set the help file path to that combined
  80. // with the help file name.
  81. //
  82. if ( ::GetModuleFileName( GetModuleInstance(), szPath, _MAX_PATH ) > 0 )
  83. {
  84. _tsplitpath( szPath, szDrive, szDir, NULL, NULL );
  85. _tmakepath( szPath, szDrive, szDir, PszHelpFileName(), NULL );
  86. m_pszHelpFilePath = new TCHAR [lstrlen( szPath ) + 1];
  87. ATLASSERT( m_pszHelpFilePath != NULL );
  88. if ( m_pszHelpFilePath != NULL )
  89. {
  90. lstrcpy( m_pszHelpFilePath, szPath );
  91. } // if: buffer allocated successfully
  92. } // if: module path obtained successfully
  93. } // if: no help file path specified yet
  94. return m_pszHelpFilePath;
  95. } //*** PszHelpFilePath()
  96. // Return the name of the help file
  97. virtual LPCTSTR PszHelpFileName( void )
  98. {
  99. //
  100. // Override this method or no help file name will
  101. // be specified for this application.
  102. //
  103. return NULL;
  104. } //*** PszHelpFileName()
  105. private:
  106. LPTSTR m_pszHelpFilePath;
  107. }; //*** class CBaseApp
  108. /////////////////////////////////////////////////////////////////////////////
  109. #endif // __ATLBASEAPP_H_