35 #pragma comment(lib, "shell32") // link to shell32.dll 41 const 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)
263 #else // _com_ptr not available -> use SIfacePtr 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()");
379 #if 0 // ILCombine() was missing in previous versions of MinGW and is not exported from shell32.dll on Windows 2000. 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;
558 hr = pcm->InvokeCommand(&cmi);
UINT ILGetSize_local(LPCITEMIDLIST pidl)
void split(ShellPath &parent, ShellPath &obj) const
SpecialFolderFSPath(int folder, HWND hwnd)
file system path of special folder
#define _stprintf_s2(b, l, f, p1, p2)
LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
easy retrieval of multi byte strings out of STRRET structures
DWORD WINAPI GetLastError(VOID)
GLint GLint GLint GLint GLint x
#define FCIDM_SHVIEWFIRST
IShellFolder smart pointer.
GLfloat GLfloat GLfloat GLfloat h
GLsizei GLsizei GLuint * obj
Exception with context information.
HRESULT name_from_pidl(IShellFolder *folder, LPCITEMIDLIST pidl, LPTSTR buffer, int len, SHGDNF flags)
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
static UINT WPARAM LPARAM lparam
String get_name(LPCITEMIDLIST pidl, SHGDNF flags=SHGDN_NORMAL) const
void attach(IShellFolder *parent, LPCITEMIDLIST pidl)
easy retrieval of wide char strings out of STRRET structures
TCHAR _fullpath[MAX_PATH]
HRESULT path_from_pidlA(IShellFolder *folder, LPCITEMIDLIST pidl, LPSTR buffer, int len)
void HandleException(COMException &e, HWND hwnd)
Exception Handler for COM exceptions.
#define ERROR_INVALID_WINDOW_HANDLE
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
static IShellFolder ShellFolder
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
#define memcpy(s1, s2, n)
void GetUIObjectOf(REFIID riid, LPVOID *ppvOut, HWND hWnd=0, ShellFolder &sf=GetDesktopFolder())
BOOL WINAPI DestroyMenu(_In_ HMENU)
ShellFolder & GetDesktopFolder()
LPVOID Alloc([in] SIZE_T cb)
static CommonShellMalloc s_cmn_shell_malloc
ShellPath create_absolute_pidl(LPCITEMIDLIST parent_pidl) const
caching of desktop ShellFolder object
#define CSIDL_FLAG_CREATE
GLint GLint GLint GLint GLint GLint y
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
HMENU WINAPI CreatePopupMenu(void)
BOOL WINAPI IsWindowVisible(_In_ HWND)
ITEMIDLIST UNALIGNED * LPITEMIDLIST
HRESULT path_from_pidlW(IShellFolder *folder, LPCITEMIDLIST pidl, LPWSTR buffer, int len)
HRESULT ShellFolderContextMenu(IShellFolder *shell_folder, HWND hwndParent, int cidl, LPCITEMIDLIST *apidl, int x, int y, CtxMenuInterfaces &cm_ifs)
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
We use a common IMalloc object for all shell memory allocations.
BOOL WINAPI TrackPopupMenu(_In_ HMENU, _In_ UINT, _In_ int, _In_ int, _Reserved_ int, _In_ HWND, _Reserved_ LPCRECT)
wrapper class for item ID lists
static UINT WPARAM wparam
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)
LPCTSTR ErrorMessage() const