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.

70 lines
1.8 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997.
  5. //
  6. // File: O P E N F O L D . C P P
  7. //
  8. // Contents: Folder launching code for the connections folder
  9. //
  10. // Notes:
  11. //
  12. // Author: jeffspr 12 Jan 1998
  13. //
  14. //----------------------------------------------------------------------------
  15. #include "pch.h"
  16. #pragma hdrstop
  17. // Undocument shell32 stuff. Sigh.
  18. #define DONT_WANT_SHELLDEBUG 1
  19. #define NO_SHIDLIST 1
  20. #define USE_SHLWAPI_IDLIST
  21. //+---------------------------------------------------------------------------
  22. //
  23. // Function: HrOpenSpecialShellFolder
  24. //
  25. // Purpose: Open one of the standard shell folders by CSIDL id.
  26. //
  27. // Arguments:
  28. // hwnd [in] Window for popups if needed.
  29. // iStandardFolderID [in] CSIDL_ of the folder in question.
  30. //
  31. // Returns:
  32. //
  33. // Author: jeffspr 24 Jan 2000
  34. //
  35. // Notes:
  36. //
  37. HRESULT HrOpenSpecialShellFolder(HWND hwnd, INT iStandardFolderID)
  38. {
  39. HRESULT hr = S_OK;
  40. HCURSOR hcWait = SetCursor(LoadCursor(NULL, IDC_WAIT));
  41. LPITEMIDLIST pidlFolder = NULL;;
  42. hr = SHGetSpecialFolderLocation(hwnd, iStandardFolderID, &pidlFolder);
  43. if (SUCCEEDED(hr))
  44. {
  45. Assert(pidlFolder);
  46. SHELLEXECUTEINFO shei = { 0 };
  47. shei.cbSize = sizeof(shei);
  48. shei.fMask = SEE_MASK_IDLIST | SEE_MASK_INVOKEIDLIST | SEE_MASK_FLAG_DDEWAIT;
  49. shei.nShow = SW_SHOW; // used to be SW_SHOWNORMAL
  50. shei.lpIDList = pidlFolder;
  51. ShellExecuteEx(&shei);
  52. SHFree(pidlFolder);
  53. }
  54. if (hcWait)
  55. {
  56. SetCursor(hcWait);
  57. }
  58. TraceHr(ttidError, FAL, hr, FALSE, "HrOpenConnectionsFolder");
  59. return hr;
  60. }