#include "winefile.h"
Go to the source code of this file.
Functions | |
static void | CtxMenu_reset (void) |
static IContextMenu * | CtxMenu_query_interfaces (IContextMenu *pcm1) |
BOOL | CtxMenu_HandleMenuMsg (UINT nmsg, WPARAM wparam, LPARAM lparam) |
HRESULT | ShellFolderContextMenu (IShellFolder *shell_folder, HWND hwndParent, int cidl, LPCITEMIDLIST *apidl, int x, int y) |
Variables | |
static IContextMenu2 * | s_pctxmenu2 = NULL |
IContextMenu3 * | s_pctxmenu3 = NULL |
BOOL CtxMenu_HandleMenuMsg | ( | UINT | nmsg, | |
WPARAM | wparam, | |||
LPARAM | lparam | |||
) |
Definition at line 56 of file shelltools.c.
References s_pctxmenu2, and s_pctxmenu3.
00057 { 00058 if (s_pctxmenu3) { 00059 if (SUCCEEDED((*s_pctxmenu3->lpVtbl->HandleMenuMsg)(s_pctxmenu3, nmsg, wparam, lparam))) 00060 return TRUE; 00061 } 00062 00063 if (s_pctxmenu2) 00064 if (SUCCEEDED((*s_pctxmenu2->lpVtbl->HandleMenuMsg)(s_pctxmenu2, nmsg, wparam, lparam))) 00065 return TRUE; 00066 00067 return FALSE; 00068 }
static IContextMenu* CtxMenu_query_interfaces | ( | IContextMenu * | pcm1 | ) | [static] |
Definition at line 37 of file shelltools.c.
References CtxMenu_reset(), s_pctxmenu2, and s_pctxmenu3.
Referenced by ShellFolderContextMenu().
00038 { 00039 IContextMenu* pcm = NULL; 00040 00041 CtxMenu_reset(); 00042 00043 if (IUnknown_QueryInterface(pcm1, &IID_IContextMenu3, (void**)&pcm) == NOERROR) 00044 s_pctxmenu3 = (LPCONTEXTMENU3)pcm; 00045 else if (IUnknown_QueryInterface(pcm1, &IID_IContextMenu2, (void**)&pcm) == NOERROR) 00046 s_pctxmenu2 = (LPCONTEXTMENU2)pcm; 00047 00048 if (pcm) { 00049 IUnknown_Release(pcm1); 00050 return pcm; 00051 } else 00052 return pcm1; 00053 }
static void CtxMenu_reset | ( | void | ) | [static] |
Definition at line 30 of file shelltools.c.
References s_pctxmenu2, and s_pctxmenu3.
Referenced by CtxMenu_query_interfaces(), and ShellFolderContextMenu().
00031 { 00032 s_pctxmenu2 = NULL; 00033 s_pctxmenu3 = NULL; 00034 }
HRESULT ShellFolderContextMenu | ( | IShellFolder * | shell_folder, | |
HWND | hwndParent, | |||
int | cidl, | |||
LPCITEMIDLIST * | apidl, | |||
int | x, | |||
int | y | |||
) |
Definition at line 72 of file shelltools.c.
References CtxMenu_query_interfaces(), and CtxMenu_reset().
00073 { 00074 IContextMenu* pcm; 00075 BOOL executed = FALSE; 00076 00077 HRESULT hr = IShellFolder_GetUIObjectOf(shell_folder, hwndParent, cidl, apidl, &IID_IContextMenu, NULL, (LPVOID*)&pcm); 00078 /* HRESULT hr = CDefFolderMenu_Create2(dir?dir->_pidl:DesktopFolder(), hwndParent, 1, &pidl, shell_folder, NULL, 0, NULL, &pcm); */ 00079 00080 if (SUCCEEDED(hr)) { 00081 HMENU hmenu = CreatePopupMenu(); 00082 00083 pcm = CtxMenu_query_interfaces(pcm); 00084 00085 if (hmenu) { 00086 hr = (*pcm->lpVtbl->QueryContextMenu)(pcm, hmenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, CMF_NORMAL); 00087 00088 if (SUCCEEDED(hr)) { 00089 UINT idCmd = TrackPopupMenu(hmenu, TPM_LEFTALIGN|TPM_RETURNCMD|TPM_RIGHTBUTTON, x, y, 0, hwndParent, NULL); 00090 00091 CtxMenu_reset(); 00092 00093 if (idCmd) { 00094 CMINVOKECOMMANDINFO cmi; 00095 00096 cmi.cbSize = sizeof(CMINVOKECOMMANDINFO); 00097 cmi.fMask = 0; 00098 cmi.hwnd = hwndParent; 00099 cmi.lpVerb = (LPCSTR)(INT_PTR)(idCmd - FCIDM_SHVIEWFIRST); 00100 cmi.lpParameters = NULL; 00101 cmi.lpDirectory = NULL; 00102 cmi.nShow = SW_SHOWNORMAL; 00103 cmi.dwHotKey = 0; 00104 cmi.hIcon = 0; 00105 00106 hr = (*pcm->lpVtbl->InvokeCommand)(pcm, &cmi); 00107 executed = TRUE; 00108 } 00109 } else 00110 CtxMenu_reset(); 00111 } 00112 00113 IUnknown_Release(pcm); 00114 } 00115 00116 return FAILED(hr)? hr: executed? S_OK: S_FALSE; 00117 }
IContextMenu2* s_pctxmenu2 = NULL [static] |
Definition at line 26 of file shelltools.c.
Referenced by CtxMenu_HandleMenuMsg(), CtxMenu_query_interfaces(), and CtxMenu_reset().
IContextMenu3* s_pctxmenu3 = NULL |
Definition at line 27 of file shelltools.c.
Referenced by CtxMenu_HandleMenuMsg(), CtxMenu_query_interfaces(), and CtxMenu_reset().
Winefile Source Code Documentation
generated on 15.09.2008 by |