Classes | Defines | Functions

shellclasses.h File Reference

#include <shellapi.h>
#include <shlobj.h>
Include dependency graph for shellclasses.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  COMException
 Exception with context information. More...
struct  ComInit
 COM Initialisation. More...
struct  OleInit
 OLE initialisation for drag drop support. More...
struct  CommonShellMalloc
 We use a common IMalloc object for all shell memory allocations. More...
struct  ShellMalloc
 wrapper class for IMalloc with usage of common allocator More...
struct  SShellPtr< T >
 wrapper template class for pointers to shell objects managed by IMalloc More...
struct  SIfacePtr< T >
 wrapper class for COM interface pointers More...
struct  ComSrvObject
struct  SimpleComObject
struct  IComSrvQI< BASE >
struct  IComSrvQI< IUnknown >
class  IComSrvBase< BASE, OBJ >
struct  CommonDesktop
 caching of desktop ShellFolder object More...
struct  ShellFolder
 IShellFolder smart pointer. More...
struct  ShellLinkPtr
 IShellLink smart pointer. More...
struct  ShellPath
 wrapper class for item ID lists More...
struct  StrRetA
 easy retrieval of multi byte strings out of STRRET structures More...
struct  StrRetW
 easy retrieval of wide char strings out of STRRET structures More...
class  FileSysShellPath
 Retrieval of file system paths of ShellPath objects. More...
struct  FolderBrowser
 Browse dialog operating on shell namespace. More...
struct  SpecialFolderPath
 Retrieval of special shell folder paths. More...
struct  DesktopFolderPath
 Shell folder path of the desktop. More...
struct  SpecialFolder
 Retrieval of special shell folder. More...
struct  DesktopFolder
 Shell folder of the desktop. More...
struct  SpecialFolderFSPath
 file system path of special folder More...
struct  ShellItemEnumerator
 wrapper class for enumerating shell namespace objects More...
struct  PIDList
 list of PIDLs More...
struct  CtxMenuInterfaces
struct  ExtContextMenuHandlerT< BASE >

Defines

#define NOVTABLE
#define ANSUNC
#define COMExceptionBase   _com_error
#define THROW_EXCEPTION(hr)   throw COMException(hr, __FILE__, __LINE__)
#define CHECKERROR(hr)   ((void)(FAILED(hr)? THROW_EXCEPTION(hr): 0))
#define IShellLinkPtr   IShellLinkAPtr
#define path_from_pidl   path_from_pidlA
#define ILGetSize   ILGetSize_local
#define UNION_MEMBER(x)   x
#define StrRet   StrRetA

Functions

void HandleException (COMException &e, HWND hwnd)
 Exception Handler for COM exceptions.
ShellFolderGetDesktopFolder ()
HRESULT path_from_pidlA (IShellFolder *folder, LPCITEMIDLIST pidl, LPSTR buffer, int len)
HRESULT path_from_pidlW (IShellFolder *folder, LPCITEMIDLIST pidl, LPWSTR buffer, int len)
HRESULT name_from_pidl (IShellFolder *folder, LPCITEMIDLIST pidl, LPTSTR buffer, int len, SHGDNF flags)
UINT ILGetSize_local (LPCITEMIDLIST pidl)
HRESULT ShellFolderContextMenu (IShellFolder *shell_folder, HWND hwndParent, int cidl, LPCITEMIDLIST *ppidl, int x, int y, CtxMenuInterfaces &cm_ifs)

Define Documentation

#define ANSUNC

Definition at line 60 of file shellclasses.h.

#define CHECKERROR (   hr )    ((void)(FAILED(hr)? THROW_EXCEPTION(hr): 0))
#define COMExceptionBase   _com_error

Definition at line 67 of file shellclasses.h.

#define ILGetSize   ILGetSize_local
#define IShellLinkPtr   IShellLinkAPtr

Definition at line 573 of file shellclasses.h.

#define NOVTABLE

Definition at line 58 of file shellclasses.h.

#define path_from_pidl   path_from_pidlA

Definition at line 628 of file shellclasses.h.

Referenced by ShellDirectory::get_path(), and ShellDirectory::read_directory().

#define StrRet   StrRetA

Definition at line 871 of file shellclasses.h.

Referenced by ShellFolder::get_name(), and name_from_pidl().

#define THROW_EXCEPTION (   hr )    throw COMException(hr, __FILE__, __LINE__)

Definition at line 161 of file shellclasses.h.

Referenced by BStr::assign(), ScanNTFSStreams(), and WebChildWindow::WndProc().

#define UNION_MEMBER (   x )    x

Definition at line 861 of file shellclasses.h.

Referenced by StrRetW::GetString(), and StrRetA::GetString().


Function Documentation

ShellFolder& GetDesktopFolder (  )
void HandleException ( COMException e,
HWND  hwnd 
)

Exception Handler for COM exceptions.

Definition at line 93 of file shellclasses.cpp.

References TEXT, and COMException::toString().

Referenced by PropertySheetDialog::DoModal(), explorer_main(), StartMenu::Init(), ShellBrowser::InsertSubitems(), Window::MessageLoop(), MainFrameBase::OpenShellFolders(), ShellDirectory::read_directory(), StartMenuRoot::TrackStartmenu(), and WebChildWindow::WndProc().

{
    String msg = e.toString();

    SetLastError(0);

    if (hwnd && !IsWindowVisible(hwnd))
        hwnd = 0;

    MessageBox(hwnd, msg, TEXT("ShellClasses Exception"), MB_ICONHAND|MB_OK);

     // If displaying the error message box _with_ parent was not successfull, display it now without a parent window.
    if (GetLastError() == ERROR_INVALID_WINDOW_HANDLE)
        MessageBox(0, msg, TEXT("ShellClasses Exception"), MB_ICONHAND|MB_OK);
}

Here is the call graph for this function:

Here is the caller graph for this function:

UINT ILGetSize_local ( LPCITEMIDLIST  pidl )

Definition at line 428 of file shellclasses.cpp.

{
    if (!pidl)
        return 0;

    int l = sizeof(USHORT/*SHITEMID::cb*/);

    while(pidl->mkid.cb) {
        l += pidl->mkid.cb;
        pidl = LPCITEMIDLIST((LPBYTE)pidl+pidl->mkid.cb);
    }

    return l;
}
HRESULT name_from_pidl ( IShellFolder *  folder,
LPCITEMIDLIST  pidl,
LPTSTR  buffer,
int  len,
SHGDNF  flags 
)

Definition at line 175 of file shellclasses.cpp.

References CONTEXT, and StrRet.

Referenced by ShellDirectory::read_directory().

{
    CONTEXT("name_from_pidl()");

    StrRet str;

    HRESULT hr = folder->GetDisplayNameOf(pidl, flags, &str);

    if (SUCCEEDED(hr))
        str.GetString(pidl->mkid, buffer, len);
    else
        buffer[0] = '\0';

    return hr;
}

Here is the caller graph for this function:

HRESULT path_from_pidlA ( IShellFolder *  folder,
LPCITEMIDLIST  pidl,
LPSTR  buffer,
int  len 
)

Definition at line 143 of file shellclasses.cpp.

References CONTEXT, and StrRetA::GetString().

{
    CONTEXT("path_from_pidlA()");

    StrRetA str;

    HRESULT hr = folder->GetDisplayNameOf(pidl, SHGDN_FORPARSING, &str);

    if (SUCCEEDED(hr))
        str.GetString(pidl->mkid, buffer, len);
    else
        buffer[0] = '\0';

    return hr;
}

Here is the call graph for this function:

HRESULT path_from_pidlW ( IShellFolder *  folder,
LPCITEMIDLIST  pidl,
LPWSTR  buffer,
int  len 
)

Definition at line 159 of file shellclasses.cpp.

References CONTEXT, and StrRetW::GetString().

{
    CONTEXT("path_from_pidlW()");

    StrRetW str;

    HRESULT hr = folder->GetDisplayNameOf(pidl, SHGDN_FORPARSING, &str);

    if (SUCCEEDED(hr))
        str.GetString(pidl->mkid, buffer, len);
    else
        buffer[0] = '\0';

    return hr;
}

Here is the call graph for this function:

HRESULT ShellFolderContextMenu ( IShellFolder *  shell_folder,
HWND  hwndParent,
int  cidl,
LPCITEMIDLIST *  ppidl,
int  x,
int  y,
CtxMenuInterfaces cm_ifs 
)

Definition at line 531 of file shellclasses.cpp.

References CtxMenuInterfaces::query_interfaces(), and CtxMenuInterfaces::reset().

Referenced by ShellEntry::do_context_menu(), Entry::do_context_menu(), and DesktopShellView::DoContextMenu().

{
    IContextMenu* pcm;

    HRESULT hr = shell_folder->GetUIObjectOf(hwndParent, cidl, apidl, IID_IContextMenu, NULL, (LPVOID*)&pcm);
//  HRESULT hr = CDefFolderMenu_Create2(dir?dir->_pidl:DesktopFolder(), hwndParent, 1, &pidl, shell_folder, NULL, 0, NULL, &pcm);

    if (SUCCEEDED(hr)) {
        pcm = cm_ifs.query_interfaces(pcm);

        HMENU hmenu = CreatePopupMenu();

        if (hmenu) {
            hr = pcm->QueryContextMenu(hmenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, CMF_NORMAL|CMF_EXPLORE);

            if (SUCCEEDED(hr)) {
                UINT idCmd = TrackPopupMenu(hmenu, TPM_LEFTALIGN|TPM_RETURNCMD|TPM_RIGHTBUTTON, x, y, 0, hwndParent, NULL);

                cm_ifs.reset();

                if (idCmd) {
                  CMINVOKECOMMANDINFO cmi;

                  cmi.cbSize = sizeof(CMINVOKECOMMANDINFO);
                  cmi.fMask = 0;
                  cmi.hwnd = hwndParent;
                  cmi.lpVerb = (LPCSTR)(INT_PTR)(idCmd - FCIDM_SHVIEWFIRST);
                  cmi.lpParameters = NULL;
                  cmi.lpDirectory = NULL;
                  cmi.nShow = SW_SHOWNORMAL;
                  cmi.dwHotKey = 0;
                  cmi.hIcon = 0;

                  hr = pcm->InvokeCommand(&cmi);
                }
            } else
                cm_ifs.reset();
            DestroyMenu(hmenu);
        }

        pcm->Release();
    }

    return hr;
}

Here is the call graph for this function:

Here is the caller graph for this function:


ROS Explorer Source Code Documentation
generated on 02.01.2013 by doxygen

ROS Explorer Homepage