Source code of Windows XP (NT5)
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.

81 lines
2.0 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1999.
  5. //
  6. // File: N C S H E L L . C P P
  7. //
  8. // Contents: Common routines for dealing with shell interfaces.
  9. //
  10. // Notes:
  11. //
  12. // Author: anbrad 08 Jun 1999
  13. //
  14. //----------------------------------------------------------------------------
  15. #include <pch.h>
  16. #pragma hdrstop
  17. #include "shlobj.h"
  18. #include <shlobjp.h>
  19. #include "pidlutil.h"
  20. //+---------------------------------------------------------------------------
  21. //
  22. // Function: GenerateEvent
  23. //
  24. // Purpose: Generate a Shell Notification event.
  25. //
  26. // Arguments:
  27. // lEventId [in] The event ID to post
  28. // pidlFolder [in] Folder pidl
  29. // pidlIn [in] First pidl that we reference
  30. // pidlNewIn [in] If needed, the second pidl.
  31. //
  32. // Returns:
  33. //
  34. // Author: jeffspr 16 Dec 1997
  35. //
  36. // Notes:
  37. //
  38. VOID GenerateEvent(
  39. LONG lEventId,
  40. LPCITEMIDLIST pidlFolder,
  41. LPCITEMIDLIST pidlIn,
  42. LPCITEMIDLIST pidlNewIn)
  43. {
  44. // Build an absolute pidl from the folder pidl + the object pidl
  45. //
  46. LPITEMIDLIST pidl = ILCombine(pidlFolder, pidlIn);
  47. if (pidl)
  48. {
  49. // If we have two pidls, call the notify with both
  50. //
  51. if (pidlNewIn)
  52. {
  53. // Build the second absolute pidl
  54. //
  55. LPITEMIDLIST pidlNew = ILCombine(pidlFolder, pidlNewIn);
  56. if (pidlNew)
  57. {
  58. // Make the notification, and free the new pidl
  59. //
  60. SHChangeNotify(lEventId, SHCNF_IDLIST, pidl, pidlNew);
  61. FreeIDL(pidlNew);
  62. }
  63. }
  64. else
  65. {
  66. // Make the single-pidl notification
  67. //
  68. SHChangeNotify(lEventId, SHCNF_IDLIST, pidl, NULL);
  69. }
  70. // Always refresh, then free the newly allocated pidl
  71. //
  72. SHChangeNotifyHandleEvents();
  73. FreeIDL(pidl);
  74. }
  75. }