Export (0) Print
Expand All

IShellLibrary::RemoveFolder method

Removes a folder from the library.

Syntax


HRESULT RemoveFolder(
  [in]  IShellItem *psiLocation
);

Parameters

psiLocation [in]

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

Minimum supported client

Windows 7 [desktop apps only]

Minimum supported server

Windows Server 2008 R2 [desktop apps only]

Header

Shobjidl.h

IDL

Shobjidl.idl

See also

Windows Libraries
IShellLibrary
SHAddFolderPathToLibrary
SHLoadLibraryFromItem
SHLoadLibraryFromKnownFolder
SHLoadLibraryFromParsingName
SHRemoveFolderPathFromLibrary
IShellLibrary::AddFolder
IShellLibrary::LoadLibraryFromItem
IShellLibrary::LoadLibraryFromKnownFolder

 

 

Community Additions

ADD
Show:
© 2014 Microsoft