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.

48 lines
1.8 KiB

  1. // Helper to create a IExtractIcon handler.
  2. //
  3. // Usage:
  4. // (1) Derive from CExtractIconBase to implement your business logic by
  5. // overloading CExtractIconBase two virtual member fcts
  6. // ex: class CEIBMyDerivedClass : public CExtractIconBase
  7. //
  8. // (2) Add a few Initalization member fcts
  9. // ex: HRESULT CEIBMyDerivedClass::MyInit(MyData1* p1, MyData2* p2);
  10. //
  11. // (3) Create your derived object using the new operator,
  12. // ex: CEIBMyDerivedClass* peibmdc = new ...
  13. //
  14. // (4) Initialize it (using (2)),
  15. // ex: hr = peibmdc->MyInit(p1, p2);
  16. //
  17. class CExtractIconBase : public IExtractIconA, public IExtractIconW
  18. {
  19. public:
  20. // IExtractIconA
  21. STDMETHODIMP GetIconLocation(UINT uFlags, LPSTR pszIconFile, UINT cchMax, int* piIndex, UINT* pwFlags);
  22. STDMETHODIMP Extract(LPCSTR pszFile, UINT nIconIndex, HICON* phiconLarge, HICON* phiconSmall, UINT nIconSize);
  23. // IExtractIconW
  24. STDMETHODIMP GetIconLocation(UINT uFlags, LPWSTR pszIconFile, UINT cchMax, int* piIndex, UINT* pwFlags);
  25. STDMETHODIMP Extract(LPCWSTR pszFile, UINT nIconIndex, HICON* phiconLarge, HICON* phiconSmall, UINT nIconSize);
  26. // IUnknown helpers
  27. STDMETHODIMP QueryInterface(REFIID riid, void** ppv);
  28. STDMETHODIMP_(ULONG) AddRef();
  29. STDMETHODIMP_(ULONG) Release();
  30. // derived class implements these
  31. virtual HRESULT _GetIconLocationW(UINT uFlags, LPWSTR pszIconFile,
  32. UINT cchMax, int *piIndex, UINT *pwFlags) PURE;
  33. virtual HRESULT _ExtractW(LPCWSTR pszFile, UINT nIconIndex,
  34. HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize) PURE;
  35. CExtractIconBase();
  36. protected:
  37. virtual ~CExtractIconBase();
  38. private:
  39. LONG _cRef;
  40. };