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.

240 lines
4.8 KiB

  1. /*++
  2. Copyright (c) 1997 Microsoft Corporation
  3. Module Name:
  4. faxsabout.cpp
  5. Abstract:
  6. Implementation of ISnapinAbout
  7. Environment:
  8. WIN32 User Mode
  9. Author:
  10. Darwin Ouyang (t-darouy) 30-Sept-1997
  11. --*/
  12. // FaxSnapin.cpp : Implementation of CFaxSnapinAbout
  13. #include "stdafx.h"
  14. #include "faxadmin.h"
  15. #include "FaxSAbout.h"
  16. #include "faxstrt.h" // string table
  17. #pragma hdrstop
  18. /////////////////////////////////////////////////////////////////////////////
  19. // CFaxSnapinAbout
  20. HRESULT
  21. STDMETHODCALLTYPE
  22. CFaxSnapinAbout::GetSnapinDescription(
  23. OUT LPOLESTR __RPC_FAR *lpDescription)
  24. /*++
  25. Routine Description:
  26. Returns a LPOLESTR to the textual description of the snapin.
  27. Arguments:
  28. lpDescription - the pointer is returned here
  29. Return Value:
  30. HRESULT indicating SUCCCEDED() or FAILED()
  31. --*/
  32. {
  33. LPTSTR description = NULL;
  34. if (!lpDescription) {
  35. return(E_POINTER);
  36. }
  37. description = ::GlobalStringTable->GetString( IDS_SNAPIN_DESCRIPTION );
  38. if( description == NULL ) {
  39. return E_UNEXPECTED;
  40. }
  41. *lpDescription = (LPOLESTR)CoTaskMemAlloc( StringSize( description ) * 2 );
  42. if( *lpDescription == NULL ) {
  43. return E_OUTOFMEMORY;
  44. }
  45. _tcscpy( *lpDescription, description );
  46. return S_OK;
  47. }
  48. HRESULT
  49. STDMETHODCALLTYPE
  50. CFaxSnapinAbout::GetProvider(
  51. OUT LPOLESTR __RPC_FAR *lpName)
  52. /*++
  53. Routine Description:
  54. Returnes the provider name of the snapin.
  55. Arguments:
  56. lpName - returns an LPOLESTR pointing to the provider name, IE Microsoft.
  57. Return Value:
  58. HRESULT indicating SUCCEEDED() or FAILED()
  59. --*/
  60. {
  61. LPTSTR name = NULL;
  62. if (!lpName) {
  63. return(E_POINTER);
  64. }
  65. name = ::GlobalStringTable->GetString( IDS_SNAPIN_PROVIDER );
  66. if( name == NULL ) {
  67. return E_UNEXPECTED;
  68. }
  69. *lpName = (LPOLESTR)CoTaskMemAlloc( StringSize( name ) * 2 );
  70. if( *lpName == NULL ) {
  71. return E_OUTOFMEMORY;
  72. }
  73. _tcscpy( *lpName, name );
  74. return S_OK;
  75. }
  76. HRESULT
  77. STDMETHODCALLTYPE
  78. CFaxSnapinAbout::GetSnapinVersion(
  79. OUT LPOLESTR __RPC_FAR *lpVersion)
  80. /*++
  81. Routine Description:
  82. Returned the version of the snapin.
  83. Arguments:
  84. lpVersion - returns an LPOLESTR pointing to the version string.
  85. Return Value:
  86. HRESULT indicating SUCCEEDED() or FAILED()
  87. --*/
  88. {
  89. LPTSTR version = NULL;
  90. if (!lpVersion) {
  91. return(E_POINTER);
  92. }
  93. version = ::GlobalStringTable->GetString( IDS_SNAPIN_VERSION );
  94. if( version == NULL ) {
  95. return E_UNEXPECTED;
  96. }
  97. *lpVersion = (LPOLESTR)CoTaskMemAlloc( StringSize( version ) * 2 );
  98. if( *lpVersion == NULL ) {
  99. return E_OUTOFMEMORY;
  100. }
  101. _tcscpy( *lpVersion, version );
  102. return S_OK;
  103. }
  104. HRESULT
  105. STDMETHODCALLTYPE
  106. CFaxSnapinAbout::GetSnapinImage(
  107. OUT HICON __RPC_FAR *hAppIcon)
  108. /*++
  109. Routine Description:
  110. Returns an icon for the root folder of the snapin.
  111. Arguments:
  112. lpName - returns an LPOLESTR pointing to the provider name, IE Microsoft.
  113. Return Value:
  114. HRESULT indicating SUCCEEDED() or FAILED()
  115. --*/
  116. {
  117. if (!hAppIcon) {
  118. return(E_POINTER);
  119. }
  120. *hAppIcon = LoadIcon( ::GlobalStringTable->GetInstance(), MAKEINTRESOURCE( IDI_FAXSVR ) );
  121. if( *hAppIcon == NULL ) {
  122. return E_UNEXPECTED;
  123. }
  124. return S_OK;
  125. }
  126. HRESULT
  127. STDMETHODCALLTYPE
  128. CFaxSnapinAbout::GetStaticFolderImage(
  129. OUT HBITMAP __RPC_FAR *hSmallImage,
  130. OUT HBITMAP __RPC_FAR *hSmallImageOpen,
  131. OUT HBITMAP __RPC_FAR *hLargeImage,
  132. OUT COLORREF __RPC_FAR *cMask)
  133. /*++
  134. Routine Description:
  135. Returns bitmaps for the root folder of the snapin.
  136. Arguments:
  137. hSnallImage - 16x16 image closed state
  138. hSmallImageOpen - 16x16 image open state
  139. hLargeInmage - 32x32 image
  140. cmask - colour mask
  141. Return Value:
  142. HRESULT indicating SUCCEEDED() or FAILED()
  143. --*/
  144. {
  145. if (!cMask || !hSmallImage || !hLargeImage || !hSmallImageOpen) {
  146. return E_POINTER;
  147. }
  148. *cMask = 0x00ff00ff;
  149. *hSmallImage = LoadBitmap( ::GlobalStringTable->GetInstance(), MAKEINTRESOURCE( IDB_MAINSMALL ) );
  150. assert( *hSmallImage != NULL );
  151. if( *hSmallImage == NULL ) {
  152. return E_UNEXPECTED;
  153. }
  154. *hSmallImageOpen = LoadBitmap( ::GlobalStringTable->GetInstance(), MAKEINTRESOURCE( IDB_MAINSMALL ) );
  155. assert( *hSmallImageOpen != NULL );
  156. if( *hSmallImageOpen == NULL ) {
  157. return E_UNEXPECTED;
  158. }
  159. *hLargeImage = LoadBitmap( ::GlobalStringTable->GetInstance(), MAKEINTRESOURCE( IDB_MAINLARGE ) );
  160. assert( *hLargeImage != NULL );
  161. if( *hLargeImage == NULL ) {
  162. return E_UNEXPECTED;
  163. }
  164. return S_OK;
  165. }