Defines | Functions

shellclasses.cpp File Reference

#include <precomp.h>
Include dependency graph for shellclasses.cpp:

Go to the source code of this file.

Defines

#define CSIDL_FLAG_CREATE   0x8000

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 *apidl, int x, int y, CtxMenuInterfaces &cm_ifs)

Define Documentation

#define CSIDL_FLAG_CREATE   0x8000

Definition at line 445 of file shellclasses.cpp.

Referenced by SpecialFolderFSPath::SpecialFolderFSPath().


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 *  apidl,
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