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 / shexinit.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1997-10-05  |  1.7 KB  |  59 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. //  MODULE:   shexinit.cpp
  9. //
  10. //  PURPOSE:   Implements the IShellExtInit member function necessary to support
  11. //             the context menu and property sheet portioins of this shell extension.  
  12. //
  13.  
  14. #include "priv.h"
  15. #include "shellext.h"
  16.  
  17.  
  18. //
  19. //  FUNCTION: CShellExt::Initialize(LPCITEMIDLIST, LPDATAOBJECT, HKEY)
  20. //
  21. //  PURPOSE: Called by the shell when initializing a context menu or property
  22. //           sheet extension.
  23. //
  24. //  PARAMETERS:
  25. //    pIDFolder - Specifies the parent folder
  26. //    pDataObj  - Spefifies the set of items selected in that folder.
  27. //    hRegKey   - Specifies the type of the focused item in the selection.
  28. //
  29. //  RETURN VALUE:
  30. //
  31. //    NOERROR in all cases.
  32. //
  33. //  COMMENTS:   Note that at the time this function is called, we don't know 
  34. //              (or care) what type of shell extension is being initialized.  
  35. //              It could be a context menu or a property sheet.
  36. //
  37.  
  38. STDMETHODIMP CShellExt::Initialize(LPCITEMIDLIST pIDFolder,
  39.                                    LPDATAOBJECT pDataObj,
  40.                                    HKEY hRegKey)
  41. {
  42.     ODS("CShellExt::Initialize()\r\n");
  43.  
  44.     // Initialize can be called more than once
  45.  
  46.     if (m_pDataObj)
  47.         m_pDataObj->Release();
  48.  
  49.     // duplicate the object pointer and registry handle
  50.  
  51.     if (pDataObj)
  52.     {
  53.         m_pDataObj = pDataObj;
  54.         pDataObj->AddRef();
  55.     }
  56.  
  57.     return NOERROR;
  58. }
  59.