home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / winui / shell / shellext / iconhdlr.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1997-10-05  |  3.0 KB  |  105 lines

  1. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
  2. // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
  3. // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  4. // PARTICULAR PURPOSE.
  5. //
  6. // Copyright (C) 1993-1997  Microsoft Corporation.  All Rights Reserved.
  7. //
  8. // Modudule: ICONHDLR.CPP
  9. //
  10. // Purpose:  Implements the IExtractIcon and IPersistFile member
  11. //           functions necessary to support the icon handler portion
  12. //           of this shell extension.
  13. //
  14.  
  15. #include "priv.h"
  16. #include "shellext.h"
  17.  
  18. extern HINSTANCE g_hmodThisDll; // Handle to this DLL itself.
  19.  
  20. // *********************** IExtractIcon Implementation *************************
  21.  
  22. STDMETHODIMP CShellExt::GetIconLocation(UINT   uFlags,
  23.                                         LPSTR  szIconFile,
  24.                                         UINT   cchMax,
  25.                                         int   *piIndex,
  26.                                         UINT  *pwFlags)
  27. {  
  28.     ODS("CShellExt::GetIconLocation()\r\n");
  29.  
  30.     GetModuleFileName(g_hmodThisDll, szIconFile, cchMax);
  31.  
  32.     *piIndex = (int)GetPrivateProfileInt("IconImage", 
  33.                                          "Index", 
  34.                                          0, 
  35.                                          m_szFileUserClickedOn);
  36.  
  37.     return S_OK;
  38. }
  39.  
  40.  
  41. STDMETHODIMP CShellExt::Extract(LPCSTR pszFile,
  42.                                 UINT   nIconIndex,
  43.                                 HICON  *phiconLarge,
  44.                                 HICON  *phiconSmall,
  45.                                 UINT   nIconSize)
  46. {
  47.     ODS("CShellExt::Extract()\r\n");
  48.  
  49.     return S_FALSE;
  50. }
  51.  
  52.  
  53. // *********************** IPersistFile Implementation ******************
  54.  
  55. STDMETHODIMP CShellExt::GetClassID(LPCLSID lpClassID)
  56. {
  57.     ODS("CShellExt::GetClassID()\r\n");
  58.  
  59.     return E_FAIL;
  60. }
  61.  
  62. STDMETHODIMP CShellExt::IsDirty()
  63. {
  64.     ODS("CShellExt::IsDirty()\r\n");
  65.  
  66.     return S_FALSE;
  67. }
  68.  
  69. STDMETHODIMP CShellExt::Load(LPCOLESTR lpszFileName, DWORD grfMode)
  70. {
  71.     ODS("CShellExt::Load()\r\n");
  72.  
  73.     WideCharToMultiByte(CP_ACP,                // CodePage
  74.                         0,                      // dwFlags
  75.                         lpszFileName,          // lpWideCharStr
  76.                         -1,                    // cchWideChar
  77.                         m_szFileUserClickedOn, // lpMultiByteStr
  78.                         sizeof(m_szFileUserClickedOn),  // cchMultiByte,
  79.                         NULL,                  // lpDefaultChar,
  80.                         NULL);                 // lpUsedDefaultChar
  81.  
  82.     return NOERROR;
  83. }
  84.  
  85. STDMETHODIMP CShellExt::Save(LPCOLESTR lpszFileName, BOOL fRemember)
  86. {
  87.     ODS("CShellExt::Save()\r\n");
  88.  
  89.     return E_FAIL;
  90. }
  91.  
  92. STDMETHODIMP CShellExt::SaveCompleted(LPCOLESTR lpszFileName)
  93. {
  94.     ODS("CShellExt::SaveCompleted()\r\n");
  95.  
  96.     return E_FAIL;
  97. }
  98.  
  99. STDMETHODIMP CShellExt::GetCurFile(LPOLESTR FAR* lplpszFileName)
  100. {
  101.     ODS("CShellExt::GetCurFile()\r\n");
  102.  
  103.     return E_FAIL;
  104. }
  105.