35#pragma comment(lib, "shell32")
41const LPCTSTR sCFSTR_SHELLIDLIST =
TEXT(
"Shell IDList Array");
73#ifdef __STDC_WANT_SECURE_LIB__
80#ifdef __STDC_WANT_SECURE_LIB__
130 CONTEXT(
"CommonDesktop::init()");
196 CONTEXT(
"ShellFolder::ShellFolder()");
202 super::Attach(desktop);
209 CONTEXT(
"ShellFolder::ShellFolder(IShellFolder*)");
216 CONTEXT(
"ShellFolder::ShellFolder(IShellFolder*, LPCITEMIDLIST)");
223 if (pidl && pidl->mkid.cb)
234 CONTEXT(
"ShellFolder::ShellFolder(LPCITEMIDLIST)");
239 if (pidl && pidl->mkid.cb)
250 CONTEXT(
"ShellFolder::attach(IShellFolder*, LPCITEMIDLIST)");
254 if (pidl && pidl->mkid.cb)
267 CONTEXT(
"ShellFolder::ShellFolder()");
277 CONTEXT(
"ShellFolder::ShellFolder(IShellFolder*)");
284 CONTEXT(
"ShellFolder::ShellFolder(IShellFolder*, LPCITEMIDLIST)");
286 if (pidl && pidl->mkid.cb)
296 CONTEXT(
"ShellFolder::ShellFolder(LPCITEMIDLIST)");
298 if (pidl && pidl->mkid.cb)
308 CONTEXT(
"ShellFolder::ShellFolder(IShellFolder*, LPCITEMIDLIST)");
322 CONTEXT(
"ShellFolder::get_name()");
346 for(piid=piidLast=&
_p->
mkid; piid->
cb; ) {
364 CONTEXT(
"ShellPath::GetUIObjectOf()");
384 CONTEXT(
"ShellPath::create_absolute_pidl()");
406 CONTEXT(
"ShellPath::create_absolute_pidl()");
435 while(pidl->mkid.cb) {
445#define CSIDL_FLAG_CREATE 0x8000
458 if (*s_pSHGetSpecialFolderPath)
467 if (*s_pSHGetFolderPath_shell32)
476 if (*s_pSHGetFolderPath_shfolder)
546 CMINVOKECOMMANDINFO cmi;
548 cmi.cbSize =
sizeof(CMINVOKECOMMANDINFO);
552 cmi.lpParameters =
NULL;
553 cmi.lpDirectory =
NULL;
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
GLint GLint GLint GLint GLint x
GLint GLint GLint GLint GLint GLint y
GLfloat GLfloat GLfloat GLfloat h
LPVOID Alloc([in] SIZE_T cb)
HRESULT GetUIObjectOf([in] HWND hwndOwner, [in] UINT cidl, [in, size_is(cidl)] PCUITEMID_CHILD_ARRAY apidl, [in] REFIID riid, [in, out, unique] UINT *prgfInOut, [out, iid_is(riid)] void **ppvOut)
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
#define memcpy(s1, s2, n)
#define _stprintf_s2(b, l, f, p1, p2)
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
ShellFolder & GetDesktopFolder()
HRESULT name_from_pidl(IShellFolder *folder, LPCITEMIDLIST pidl, LPTSTR buffer, int len, SHGDNF flags)
#define CSIDL_FLAG_CREATE
UINT ILGetSize_local(LPCITEMIDLIST pidl)
HRESULT ShellFolderContextMenu(IShellFolder *shell_folder, HWND hwndParent, int cidl, LPCITEMIDLIST *apidl, int x, int y, CtxMenuInterfaces &cm_ifs)
HRESULT path_from_pidlA(IShellFolder *folder, LPCITEMIDLIST pidl, LPSTR buffer, int len)
HRESULT path_from_pidlW(IShellFolder *folder, LPCITEMIDLIST pidl, LPWSTR buffer, int len)
void HandleException(COMException &e, HWND hwnd)
Exception Handler for COM exceptions.
ShellFolder & GetDesktopFolder()
#define FCIDM_SHVIEWFIRST
ITEMIDLIST UNALIGNED * LPITEMIDLIST
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
LPCTSTR ErrorMessage() const
Exception with context information.
caching of desktop ShellFolder object
We use a common IMalloc object for all shell memory allocations.
IShellFolder smart pointer.
String get_name(LPCITEMIDLIST pidl, SHGDNF flags=SHGDN_NORMAL) const
void attach(IShellFolder *parent, LPCITEMIDLIST pidl)
static CommonShellMalloc s_cmn_shell_malloc
wrapper class for item ID lists
ShellPath create_absolute_pidl(LPCITEMIDLIST parent_pidl) const
void GetUIObjectOf(REFIID riid, LPVOID *ppvOut, HWND hWnd=0, ShellFolder &sf=GetDesktopFolder())
void split(ShellPath &parent, ShellPath &obj) const
SpecialFolderFSPath(int folder, HWND hwnd)
file system path of special folder
TCHAR _fullpath[MAX_PATH]
easy retrieval of multi byte strings out of STRRET structures
easy retrieval of wide char strings out of STRRET structures
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
DWORD WINAPI GetLastError(void)
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
#define ERROR_INVALID_WINDOW_HANDLE
HMENU WINAPI CreatePopupMenu(void)
BOOL WINAPI DestroyMenu(_In_ HMENU)
BOOL WINAPI TrackPopupMenu(_In_ HMENU, _In_ UINT, _In_ int, _In_ int, _Reserved_ int, _In_ HWND, _Reserved_ LPCRECT)
BOOL WINAPI IsWindowVisible(_In_ HWND)