ReactOS 0.4.15-dev-7711-g5627da4
shellclasses.cpp File Reference
#include <precomp.h>
Include dependency graph for shellclasses.cpp:

Go to the source code of this file.

Macros

#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)
 

Macro Definition Documentation

◆ CSIDL_FLAG_CREATE

#define CSIDL_FLAG_CREATE   0x8000

Definition at line 445 of file shellclasses.cpp.

Function Documentation

◆ GetDesktopFolder()

◆ HandleException()

void HandleException ( COMException e,
HWND  hwnd 
)

Exception Handler for COM exceptions.

Definition at line 93 of file shellclasses.cpp.

94{
95 String msg = e.toString();
96
97 SetLastError(0);
98
99 if (hwnd && !IsWindowVisible(hwnd))
100 hwnd = 0;
101
102 MessageBox(hwnd, msg, TEXT("ShellClasses Exception"), MB_ICONHAND|MB_OK);
103
104 // If displaying the error message box _with_ parent was not successfull, display it now without a parent window.
106 MessageBox(0, msg, TEXT("ShellClasses Exception"), MB_ICONHAND|MB_OK);
107}
#define msg(x)
Definition: auth_time.c:54
#define SetLastError(x)
Definition: compat.h:752
#define TEXT(s)
Definition: k32.h:26
#define e
Definition: ke_i.h:82
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2433
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define ERROR_INVALID_WINDOW_HANDLE
Definition: winerror.h:881
#define MB_ICONHAND
Definition: winuser.h:787
#define MB_OK
Definition: winuser.h:789
#define MessageBox
Definition: winuser.h:5821
BOOL WINAPI IsWindowVisible(_In_ HWND)

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

◆ ILGetSize_local()

UINT ILGetSize_local ( LPCITEMIDLIST  pidl)

Definition at line 428 of file shellclasses.cpp.

429{
430 if (!pidl)
431 return 0;
432
433 int l = sizeof(USHORT/*SHITEMID::cb*/);
434
435 while(pidl->mkid.cb) {
436 l += pidl->mkid.cb;
437 pidl = LPCITEMIDLIST((LPBYTE)pidl+pidl->mkid.cb);
438 }
439
440 return l;
441}
r l[0]
Definition: byte_order.h:168
unsigned short USHORT
Definition: pedump.c:61
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
unsigned char * LPBYTE
Definition: typedefs.h:53

◆ name_from_pidl()

HRESULT name_from_pidl ( IShellFolder folder,
LPCITEMIDLIST  pidl,
LPTSTR  buffer,
int  len,
SHGDNF  flags 
)

Definition at line 175 of file shellclasses.cpp.

176{
177 CONTEXT("name_from_pidl()");
178
179 StrRet str;
180
181 HRESULT hr = folder->GetDisplayNameOf(pidl, flags, &str);
182
183 if (SUCCEEDED(hr))
184 str.GetString(pidl->mkid, buffer, len);
185 else
186 buffer[0] = '\0';
187
188 return hr;
189}
GLuint buffer
Definition: glext.h:5915
GLbitfield flags
Definition: glext.h:7161
GLenum GLsizei len
Definition: glext.h:6722
#define SUCCEEDED(hr)
Definition: intsafe.h:50
struct _CONTEXT CONTEXT
const WCHAR * str
#define StrRet
Definition: shellclasses.h:871
HRESULT hr
Definition: shlfolder.c:183
Definition: fci.c:116

Referenced by ShellDirectory::read_directory().

◆ path_from_pidlA()

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

Definition at line 143 of file shellclasses.cpp.

144{
145 CONTEXT("path_from_pidlA()");
146
147 StrRetA str;
148
149 HRESULT hr = folder->GetDisplayNameOf(pidl, SHGDN_FORPARSING, &str);
150
151 if (SUCCEEDED(hr))
152 str.GetString(pidl->mkid, buffer, len);
153 else
154 buffer[0] = '\0';
155
156 return hr;
157}
easy retrieval of multi byte strings out of STRRET structures
Definition: shellclasses.h:880

◆ path_from_pidlW()

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

Definition at line 159 of file shellclasses.cpp.

160{
161 CONTEXT("path_from_pidlW()");
162
163 StrRetW str;
164
165 HRESULT hr = folder->GetDisplayNameOf(pidl, SHGDN_FORPARSING, &str);
166
167 if (SUCCEEDED(hr))
168 str.GetString(pidl->mkid, buffer, len);
169 else
170 buffer[0] = '\0';
171
172 return hr;
173}
easy retrieval of wide char strings out of STRRET structures
Definition: shellclasses.h:906

◆ ShellFolderContextMenu()

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

Definition at line 524 of file shellclasses.cpp.

526{
527 IContextMenu* pcm;
528
529 HRESULT hr = shell_folder->GetUIObjectOf(hwndParent, cidl, apidl, IID_IContextMenu, NULL, (LPVOID*)&pcm);
530// HRESULT hr = CDefFolderMenu_Create2(dir?dir->_pidl:DesktopFolder(), hwndParent, 1, &pidl, shell_folder, NULL, 0, NULL, &pcm);
531
532 if (SUCCEEDED(hr)) {
533 pcm = cm_ifs.query_interfaces(pcm);
534
536
537 if (hmenu) {
538 hr = pcm->QueryContextMenu(hmenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, CMF_NORMAL|CMF_EXPLORE);
539
540 if (SUCCEEDED(hr)) {
542
543 cm_ifs.reset();
544
545 if (idCmd) {
546 CMINVOKECOMMANDINFO cmi;
547
548 cmi.cbSize = sizeof(CMINVOKECOMMANDINFO);
549 cmi.fMask = 0;
550 cmi.hwnd = hwndParent;
551 cmi.lpVerb = (LPCSTR)(INT_PTR)(idCmd - FCIDM_SHVIEWFIRST);
552 cmi.lpParameters = NULL;
553 cmi.lpDirectory = NULL;
554 cmi.nShow = SW_SHOWNORMAL;
555 cmi.dwHotKey = 0;
556 cmi.hIcon = 0;
557
558 hr = pcm->InvokeCommand(&cmi);
559 }
560 } else
561 cm_ifs.reset();
563 }
564
565 pcm->Release();
566 }
567
568 return hr;
569}
static HWND hwndParent
Definition: cryptui.c:300
#define NULL
Definition: types.h:112
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
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)
nsrefcnt Release()
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
unsigned int UINT
Definition: ndis.h:50
#define FCIDM_SHVIEWFIRST
Definition: shlobj.h:573
#define FCIDM_SHVIEWLAST
Definition: shlobj.h:607
IContextMenu * query_interfaces(IContextMenu *pcm1)
int32_t INT_PTR
Definition: typedefs.h:64
static HMENU hmenu
Definition: win.c:66
#define SW_SHOWNORMAL
Definition: winuser.h:769
HMENU WINAPI CreatePopupMenu(void)
Definition: menu.c:838
#define TPM_RIGHTBUTTON
Definition: winuser.h:2379
#define TPM_LEFTALIGN
Definition: winuser.h:2376
BOOL WINAPI DestroyMenu(_In_ HMENU)
BOOL WINAPI TrackPopupMenu(_In_ HMENU, _In_ UINT, _In_ int, _In_ int, _Reserved_ int, _In_ HWND, _Reserved_ LPCRECT)
#define TPM_RETURNCMD
Definition: winuser.h:2386
const char * LPCSTR
Definition: xmlstorage.h:183

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