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.

177 lines
4.9 KiB

  1. //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\
  2. //
  3. // exticon.h
  4. //
  5. // Extract icon com object.
  6. //
  7. // History:
  8. //
  9. // 3/21/97 edwardp Created.
  10. //
  11. ////////////////////////////////////////////////////////////////////////////////
  12. //
  13. // Check for previous includes of this file.
  14. //
  15. #ifndef _EXTICON_H_
  16. #define _EXTICON_H_
  17. //
  18. // Defines
  19. //
  20. #define TSTR_ICO_EXT TEXT(".ico")
  21. #define INDEX_IMAGE -1
  22. #define COLOR1 (RGB(0,0,255))
  23. #define COLOR2 (RGB(0,255,0))
  24. //
  25. // Function prototypes.
  26. //
  27. void CALLBACK ImgCtx_Callback(void* pIImgCtx, void* phEvent);
  28. void MungePath(LPTSTR pszPath);
  29. void DemungePath(LPTSTR pszPath);
  30. //
  31. // Class definition for the extract icon class.
  32. //
  33. class CExtractIcon : public IExtractIcon
  34. #ifdef UNICODE
  35. ,public IExtractIconA
  36. #endif
  37. {
  38. //
  39. // Methods
  40. //
  41. public:
  42. // Constructors
  43. CExtractIcon(PCDFITEMIDLIST pcdfidl,
  44. IXMLElementCollection* pIXMLElementCollection);
  45. CExtractIcon (
  46. PCDFITEMIDLIST pcdfidl,
  47. IXMLElement *pElem);
  48. CExtractIcon( BSTR pszPath );
  49. // IUnknown
  50. STDMETHODIMP QueryInterface(REFIID, void **);
  51. STDMETHODIMP_(ULONG) AddRef(void);
  52. STDMETHODIMP_(ULONG) Release(void);
  53. // IExtractIcon methods.
  54. STDMETHODIMP GetIconLocation(UINT uFlags,
  55. LPTSTR szIconFile,
  56. UINT cchMax,
  57. int *piIndex,
  58. UINT *pwFlags);
  59. STDMETHODIMP Extract(LPCTSTR pszFile,
  60. UINT nIconIndex,
  61. HICON *phiconLarge,
  62. HICON *phiconSmall,
  63. UINT nIconSize);
  64. #ifdef UNICODE
  65. // IExtractIconA methods.
  66. STDMETHODIMP GetIconLocation(UINT uFlags,
  67. LPSTR szIconFile,
  68. UINT cchMax,
  69. int *piIndex,
  70. UINT *pwFlags);
  71. STDMETHODIMP Extract(LPCSTR pszFile,
  72. UINT nIconIndex,
  73. HICON *phiconLarge,
  74. HICON *phiconSmall,
  75. UINT nIconSize);
  76. #endif
  77. // Public helper(s) to talk between implementations of IExtractIcon
  78. // KENSY: We should probably update the other helpers to look at this
  79. // variable instead of taking a gleam parameter.
  80. void SetGleam(BOOL fGleam) { m_fGleam = fGleam; }
  81. private:
  82. // Destructor.
  83. ~CExtractIcon(void);
  84. // Helper functions.
  85. STDMETHODIMP GetCustomIconLocation(UINT uFlags,
  86. LPTSTR szIconFile,
  87. UINT cchMax,
  88. int *piIndex,
  89. UINT *pwFlags);
  90. STDMETHODIMP GetDefaultIconLocation(UINT uFlags,
  91. LPTSTR szIconFile,
  92. UINT cchMax,
  93. int *piIndex,
  94. UINT *pwFlags);
  95. HRESULT SynchronousDownload(LPCTSTR pszFile,
  96. IImgCtx** ppIImgCtx,
  97. HANDLE hExitThreadEvent);
  98. HICON ExtractImageIcon(WORD wSize, IImgCtx* pIImgCtx, BOOL fDrawGleam);
  99. HRESULT CreateImageAndMask(IImgCtx* pIImgCtx,
  100. HDC hdcScreen,
  101. SIZE* pSize,
  102. HBITMAP* phbmImage,
  103. HBITMAP* phbmMask,
  104. BOOL fDrawGleam);
  105. HRESULT StretchBltImage(IImgCtx* pIImgCtx,
  106. const SIZE* pSize,
  107. HDC hdcDst,
  108. BOOL fDrawGleam);
  109. HRESULT CreateMask(IImgCtx* pIImgCtx,
  110. HDC hdcScreen,
  111. HDC hdc1,
  112. const SIZE* pSize,
  113. HBITMAP* phbmMask,
  114. BOOL fDrawGleam);
  115. BOOL ColorFill(HDC hdc, const SIZE* pSize, COLORREF clr);
  116. HRESULT ExtractGleamedIcon(LPCTSTR pszIconFile,
  117. int iIndex,
  118. UINT uFlags,
  119. HICON *phiconLarge,
  120. HICON *phiconSmall,
  121. UINT nIconSize);
  122. HRESULT ApplyGleamToIcon(HICON hIcon, ULONG nSize, HICON *phGleamedIcon);
  123. BOOL GetBitmapSize(HBITMAP hbmp, int* pcx, int* pcy);
  124. //
  125. // Member variables.
  126. //
  127. private:
  128. ULONG m_cRef;
  129. int m_iconType;
  130. BSTR m_bstrIconURL;
  131. BOOL m_fGleam;
  132. };
  133. #endif _EXTICON_H_