Επεξεργασία

Κοινή χρήση μέσω


IShellLibrary::RemoveFolder method (shobjidl_core.h)

Removes a folder from the library.

Syntax

HRESULT RemoveFolder(
  [in] IShellItem *psiLocation
);

Parameters

[in] psiLocation

Type: IShellItem*

An IShellItem object that represents the folder to remove.

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

For convenience, SHRemoveFolderPathFromLibrary can be used in place of this method.

Examples

The following code example shows the helper function SHRemoveFolderPathFromLibrary, which wraps this method.

//
// from shobjidl.h
//
__inline HRESULT SHRemoveFolderPathFromLibrary(
    __in IShellLibrary *plib,
    __in PCWSTR pszFolderPath)
{
    PIDLIST_ABSOLUTE pidlFolder = 
      SHSimpleIDListFromPath (pszFolderPath);
    HRESULT hr = pidlFolder ? S_OK : E_INVALIDARG;

    if (SUCCEEDED(hr))
    {
        IShellItem *psiFolder;
        hr = SHCreateItemFromIDList (
          pidlFolder, 
          IID_PPV_ARGS(&psiFolder));

        if (SUCCEEDED(hr))
        {
            hr = plib->RemoveFolder(psiFolder);
            psiFolder->Release();
        }
        CoTaskMemFree(pidlFolder);
    }
    return hr;
}

Requirements

Requirement Value
Minimum supported client Windows 7 [desktop apps only]
Minimum supported server Windows Server 2008 R2 [desktop apps only]
Target Platform Windows
Header shobjidl_core.h (include Shobjidl.h)

See also

IShellLibrary

IShellLibrary::AddFolder

IShellLibrary::LoadLibraryFromItem

IShellLibrary::LoadLibraryFromKnownFolder

SHAddFolderPathToLibrary

SHLoadLibraryFromItem

SHLoadLibraryFromKnownFolder

SHLoadLibraryFromParsingName

SHRemoveFolderPathFromLibrary

Windows Libraries