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.

154 lines
4.3 KiB

  1. //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\
  2. //
  3. // iconhand.h
  4. //
  5. // The class definition for the cdf icon handler.
  6. //
  7. // History:
  8. //
  9. // 4/23/97 edwardp Created.
  10. //
  11. ////////////////////////////////////////////////////////////////////////////////
  12. //
  13. // Check for previous includes of this file.
  14. //
  15. #ifndef _ICONHAND_H_
  16. #define _ICONHAND_H_
  17. //
  18. // Defines
  19. //
  20. #define WSTR_DEFAULT L"DefaultLogo"
  21. #define LOGO_WIDTH 80
  22. #define LOGO_WIDTH_WIDE 194
  23. #define GLEAM_OFFSET 53
  24. //
  25. // The class definition for the icon handler.
  26. //
  27. class CIconHandler : public IExtractIcon,
  28. #ifdef UNICODE
  29. public IExtractIconA,
  30. #endif
  31. public IExtractImage,
  32. public IRunnableTask,
  33. public CPersist
  34. {
  35. //
  36. // Methods.
  37. //
  38. public:
  39. // Constructor
  40. CIconHandler(void);
  41. // IUnknown
  42. STDMETHODIMP QueryInterface(REFIID, void **);
  43. STDMETHODIMP_(ULONG) AddRef(void);
  44. STDMETHODIMP_(ULONG) Release(void);
  45. // IExtractIcon methods.
  46. STDMETHODIMP GetIconLocation(UINT uFlags,
  47. LPTSTR szIconFile,
  48. UINT cchMax,
  49. int *piIndex,
  50. UINT *pwFlags);
  51. STDMETHODIMP Extract(LPCTSTR pszFile,
  52. UINT nIconIndex,
  53. HICON *phiconLarge,
  54. HICON *phiconSmall,
  55. UINT nIconSize);
  56. #ifdef UNICODE
  57. // IExtractIconA methods.
  58. STDMETHODIMP GetIconLocation(UINT uFlags,
  59. LPSTR szIconFile,
  60. UINT cchMax,
  61. int *piIndex,
  62. UINT *pwFlags);
  63. STDMETHODIMP Extract(LPCSTR pszFile,
  64. UINT nIconIndex,
  65. HICON *phiconLarge,
  66. HICON *phiconSmall,
  67. UINT nIconSize);
  68. #endif
  69. // IExtractImage
  70. STDMETHODIMP GetLocation(LPWSTR pszPathBuffer,
  71. DWORD cch,
  72. DWORD *pdwPriority,
  73. const SIZE* pSize,
  74. DWORD dwRecClrDepth,
  75. DWORD *pdwFlags);
  76. STDMETHODIMP Extract(HBITMAP* phBmp);
  77. // IRunnable task
  78. STDMETHODIMP Run(void);
  79. STDMETHODIMP Kill(BOOL fWait);
  80. STDMETHODIMP Suspend(void);
  81. STDMETHODIMP Resume(void);
  82. STDMETHODIMP_(ULONG) IsRunning(void);
  83. private:
  84. //Destructor
  85. ~CIconHandler(void);
  86. // check for default installed channel
  87. BOOL IsDefaultChannel(void);
  88. //Helper functions
  89. HRESULT ParseCdfIcon(void);
  90. HRESULT ParseCdfImage(BSTR* pbstrURL, BSTR* pbstrWURL);
  91. HRESULT ParseCdfShellLink();
  92. HRESULT ParseCdfInfoTip(void** ppv);
  93. HRESULT ExtractCustomImage(const SIZE* pSize,HBITMAP* phBmp);
  94. HRESULT ExtractDefaultImage(const SIZE* pSize,HBITMAP* phBmp);
  95. HRESULT GetBitmap(IImgCtx* pIImgCtx, const SIZE* pSize, HBITMAP* phBmp);
  96. HRESULT StretchBltCustomImage(IImgCtx* pIImgCtx,
  97. const SIZE* pSize,
  98. HDC hdcDst);
  99. HRESULT StretchBltDefaultImage(const SIZE* pSize, HDC hdcDest);
  100. HRESULT DrawGleam(HDC hdcDst);
  101. HRESULT SynchronousDownload(IImgCtx* pIImgCtx, LPCWSTR pwszURL);
  102. inline BOOL UseWideLogo(int cx) {return cx >
  103. ((LOGO_WIDTH + LOGO_WIDTH_WIDE) >> 1);}
  104. //HRESULT QueryInternetShortcut(PCDFITEMIDLIST pcdfidl,
  105. // REFIID riid,
  106. // void** ppvOut);
  107. //
  108. // Member variables.
  109. //
  110. private:
  111. ULONG m_cRef;
  112. IExtractIcon* m_pIExtractIcon;
  113. BSTR m_bstrImageURL;
  114. BSTR m_bstrImageWideURL;
  115. PCDFITEMIDLIST m_pcdfidl;
  116. BOOL m_fDone;
  117. BOOL m_fDrawGleam;
  118. DWORD m_dwClrDepth;
  119. SIZE m_rgSize;
  120. LPTSTR m_pszErrURL; // this is the res: URL that shows errors messages
  121. };
  122. #endif // _ICONHAND_H_