Leaked source code of windows server 2003
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.

105 lines
3.2 KiB

  1. /////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1998-2002 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // AtlBaseApp.inl
  7. //
  8. // Description:
  9. // Inline definitions of the CBaseApp class.
  10. //
  11. // Author:
  12. // Galen Barbee (galenb) May 21, 1998
  13. //
  14. // Revision History:
  15. //
  16. // Notes:
  17. //
  18. /////////////////////////////////////////////////////////////////////////////
  19. #pragma once
  20. #ifndef __ATLBASEAPP_INL_
  21. #define __ATLBASEAPP_INL_
  22. /////////////////////////////////////////////////////////////////////////////
  23. // Forward Class Declarations
  24. /////////////////////////////////////////////////////////////////////////////
  25. class CBaseApp;
  26. /////////////////////////////////////////////////////////////////////////////
  27. // External Class Declarations
  28. /////////////////////////////////////////////////////////////////////////////
  29. /////////////////////////////////////////////////////////////////////////////
  30. // Include Files
  31. /////////////////////////////////////////////////////////////////////////////
  32. #include <AtlBaseApp.h>
  33. /////////////////////////////////////////////////////////////////////////////
  34. // Type Definitions
  35. /////////////////////////////////////////////////////////////////////////////
  36. /////////////////////////////////////////////////////////////////////////////
  37. //++
  38. //
  39. // CBaseApp::PszHelpFilePath
  40. //
  41. // Description:
  42. // Return the path to the help file. Generate if necessary.
  43. //
  44. // Arguments:
  45. // None.
  46. //
  47. // Return Values:
  48. // String containing the help file path.
  49. //
  50. //--
  51. /////////////////////////////////////////////////////////////////////////////
  52. inline LPCTSTR CBaseApp::PszHelpFilePath( void )
  53. {
  54. //
  55. // If no help file path has been specified yet, generate
  56. // it from the module path name.
  57. //
  58. if ( m_pszHelpFilePath == NULL )
  59. {
  60. TCHAR szPath[_MAX_PATH];
  61. TCHAR szDrive[_MAX_PATH]; // not _MAX_DRIVE so we can support larger device names
  62. TCHAR szDir[_MAX_DIR];
  63. //
  64. // Get the path to this module. Split out the drive and
  65. // directory and set the help file path to that combined
  66. // with the help file name.
  67. //
  68. if ( ::GetModuleFileName( GetModuleInstance(), szPath, _MAX_PATH ) > 0 )
  69. {
  70. size_t cch;
  71. HRESULT hr;
  72. szPath[ RTL_NUMBER_OF( szPath ) - 1 ] = _T('\0');
  73. _tsplitpath( szPath, szDrive, szDir, NULL, NULL );
  74. _tmakepath( szPath, szDrive, szDir, PszHelpFileName(), NULL );
  75. cch = _tcslen( szPath ) + 1;
  76. m_pszHelpFilePath = new TCHAR[ cch ];
  77. ATLASSERT( m_pszHelpFilePath != NULL );
  78. if ( m_pszHelpFilePath != NULL )
  79. {
  80. hr = StringCchCopyN( m_pszHelpFilePath, cch, szPath, RTL_NUMBER_OF( szPath ) );
  81. ATLASSERT( SUCCEEDED( hr ) );
  82. } // if: buffer allocated successfully
  83. } // if: module path obtained successfully
  84. } // if: no help file path specified yet
  85. return m_pszHelpFilePath;
  86. } //*** CBaseApp::PszHelpFilePath
  87. /////////////////////////////////////////////////////////////////////////////
  88. #endif // __ATLBASEAPP_INL_