1 | /* $Id: contmenu.cpp,v 1.2 2000-03-26 16:34:39 cbratschi Exp $ */
|
---|
2 |
|
---|
3 | /*
|
---|
4 | * Win32 SHELL32 for OS/2
|
---|
5 | *
|
---|
6 | * Copyright 1999 Patrick Haller (haller@zebra.fh-weingarten.de)
|
---|
7 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
8 | *
|
---|
9 | * Corel WINE 20000324 level
|
---|
10 | */
|
---|
11 |
|
---|
12 | /*
|
---|
13 | * IContextMenu
|
---|
14 | *
|
---|
15 | * Copyright 1998 Juergen Schmied <juergen.schmied@metronet.de>
|
---|
16 | */
|
---|
17 |
|
---|
18 |
|
---|
19 | /*****************************************************************************
|
---|
20 | * Includes *
|
---|
21 | *****************************************************************************/
|
---|
22 |
|
---|
23 | #include <string.h>
|
---|
24 | #include <odin.h>
|
---|
25 | #include <odinwrap.h>
|
---|
26 | #include <os2sel.h>
|
---|
27 |
|
---|
28 | #define ICOM_CINTERFACE 1
|
---|
29 | #define CINTERFACE 1
|
---|
30 |
|
---|
31 |
|
---|
32 | #include "winerror.h"
|
---|
33 | #include "debugtools.h"
|
---|
34 |
|
---|
35 | #include "pidl.h"
|
---|
36 | #include "wine/obj_base.h"
|
---|
37 | #include "wine/obj_contextmenu.h"
|
---|
38 | #include "wine/obj_shellbrowser.h"
|
---|
39 | #include "wine/obj_shellextinit.h"
|
---|
40 | #include "wine/undocshell.h"
|
---|
41 |
|
---|
42 | #include "shell32_main.h"
|
---|
43 | #include "shresdef.h"
|
---|
44 |
|
---|
45 | #include <heapstring.h>
|
---|
46 | #include <misc.h>
|
---|
47 |
|
---|
48 |
|
---|
49 | /*****************************************************************************
|
---|
50 | * Local Variables *
|
---|
51 | *****************************************************************************/
|
---|
52 |
|
---|
53 | ODINDEBUGCHANNEL(shell-contmenu)
|
---|
54 |
|
---|
55 |
|
---|
56 | /**************************************************************************
|
---|
57 | * IContextMenu VTable
|
---|
58 | *
|
---|
59 | */
|
---|
60 |
|
---|
61 | static HRESULT WINAPI IContextMenu_fnQueryInterface(IContextMenu *iface, REFIID riid, LPVOID *ppvObj);
|
---|
62 | static ULONG WINAPI IContextMenu_fnAddRef(IContextMenu *iface);
|
---|
63 | static ULONG WINAPI IContextMenu_fnRelease(IContextMenu *iface);
|
---|
64 | static HRESULT WINAPI IContextMenu_fnQueryContextMenu(IContextMenu *iface, HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags);
|
---|
65 | static HRESULT WINAPI IContextMenu_fnInvokeCommand(IContextMenu *iface, LPCMINVOKECOMMANDINFO lpcmi);
|
---|
66 | static HRESULT WINAPI IContextMenu_fnGetCommandString(IContextMenu *iface, UINT idCommand, UINT uFlags, LPUINT lpReserved, LPSTR lpszName, UINT uMaxNameLen);
|
---|
67 | static HRESULT WINAPI IContextMenu_fnHandleMenuMsg(IContextMenu *iface, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
---|
68 |
|
---|
69 | static struct ICOM_VTABLE(IContextMenu) cmvt =
|
---|
70 | {
|
---|
71 | ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
|
---|
72 | IContextMenu_fnQueryInterface,
|
---|
73 | IContextMenu_fnAddRef,
|
---|
74 | IContextMenu_fnRelease,
|
---|
75 | IContextMenu_fnQueryContextMenu,
|
---|
76 | IContextMenu_fnInvokeCommand,
|
---|
77 | IContextMenu_fnGetCommandString,
|
---|
78 | IContextMenu_fnHandleMenuMsg,
|
---|
79 | (void *) 0xdeadbabe /* just paranoia */
|
---|
80 | };
|
---|
81 |
|
---|
82 | /**************************************************************************
|
---|
83 | * IContextMenu Implementation
|
---|
84 | */
|
---|
85 | typedef struct
|
---|
86 | { ICOM_VTABLE(IContextMenu)* lpvtbl;
|
---|
87 | DWORD ref;
|
---|
88 | IShellFolder* pSFParent;
|
---|
89 | LPITEMIDLIST pidl; /* root pidl */
|
---|
90 | LPITEMIDLIST *aPidls; /* array of child pidls */
|
---|
91 | BOOL bAllValues;
|
---|
92 | } IContextMenuImpl;
|
---|
93 |
|
---|
94 | //static struct ICOM_VTABLE(IContextMenu) cmvt;
|
---|
95 |
|
---|
96 | /**************************************************************************
|
---|
97 | * IContextMenu_AllocPidlTable()
|
---|
98 | */
|
---|
99 | static BOOL IContextMenu_AllocPidlTable(IContextMenuImpl *This, DWORD dwEntries)
|
---|
100 | {
|
---|
101 | dprintf(("SHELL32:contmenu:IContextMenu_AllocPidlTable(%08xh,%08xh)\n",
|
---|
102 | This,
|
---|
103 | dwEntries));
|
---|
104 |
|
---|
105 | /*add one for NULL terminator */
|
---|
106 | dwEntries++;
|
---|
107 |
|
---|
108 | This->aPidls = (LPITEMIDLIST*)SHAlloc(dwEntries * sizeof(LPITEMIDLIST));
|
---|
109 |
|
---|
110 | if(This->aPidls)
|
---|
111 | { ZeroMemory(This->aPidls, dwEntries * sizeof(LPITEMIDLIST)); /*set all of the entries to NULL*/
|
---|
112 | }
|
---|
113 | return (This->aPidls != NULL);
|
---|
114 | }
|
---|
115 |
|
---|
116 | /**************************************************************************
|
---|
117 | * IContextMenu_FreePidlTable()
|
---|
118 | */
|
---|
119 | static void IContextMenu_FreePidlTable(IContextMenuImpl *This)
|
---|
120 | {
|
---|
121 | int i;
|
---|
122 |
|
---|
123 | dprintf(("SHELL32:contmenu:IContextMenu_FreePidlTable(%08xh)\n",
|
---|
124 | This));
|
---|
125 |
|
---|
126 | if(This->aPidls)
|
---|
127 | { for(i = 0; This->aPidls[i]; i++)
|
---|
128 | { SHFree(This->aPidls[i]);
|
---|
129 | }
|
---|
130 |
|
---|
131 | SHFree(This->aPidls);
|
---|
132 | This->aPidls = NULL;
|
---|
133 | }
|
---|
134 | }
|
---|
135 |
|
---|
136 | /**************************************************************************
|
---|
137 | * IContextMenu_FillPidlTable()
|
---|
138 | */
|
---|
139 | static BOOL IContextMenu_FillPidlTable(IContextMenuImpl *This, LPCITEMIDLIST *aPidls, UINT uItemCount)
|
---|
140 | {
|
---|
141 | UINT i;
|
---|
142 |
|
---|
143 | dprintf(("SHELL32:contmenu:IContectMenu_FillPidlTable(%08xh,%08xh,%08xh)\n",
|
---|
144 | This,
|
---|
145 | aPidls,
|
---|
146 | uItemCount));
|
---|
147 |
|
---|
148 | if(This->aPidls)
|
---|
149 | { for(i = 0; i < uItemCount; i++)
|
---|
150 | { This->aPidls[i] = ILClone(aPidls[i]);
|
---|
151 | }
|
---|
152 | return TRUE;
|
---|
153 | }
|
---|
154 | return FALSE;
|
---|
155 | }
|
---|
156 |
|
---|
157 | /**************************************************************************
|
---|
158 | * IContextMenu_CanRenameItems()
|
---|
159 | */
|
---|
160 | static BOOL IContextMenu_CanRenameItems(IContextMenuImpl *This)
|
---|
161 | { UINT i;
|
---|
162 | DWORD dwAttributes;
|
---|
163 |
|
---|
164 | dprintf(("SHELL32:contmenu:IContectMenu_CanRenameItems(%08xh)\n",
|
---|
165 | This));
|
---|
166 |
|
---|
167 | if(This->aPidls)
|
---|
168 | {
|
---|
169 | for(i = 0; This->aPidls[i]; i++){} /*get the number of items assigned to This object*/
|
---|
170 | { if(i > 1) /*you can't rename more than one item at a time*/
|
---|
171 | { return FALSE;
|
---|
172 | }
|
---|
173 | }
|
---|
174 | dwAttributes = SFGAO_CANRENAME;
|
---|
175 | IShellFolder_GetAttributesOf(This->pSFParent, i, (LPCITEMIDLIST*)This->aPidls, &dwAttributes);
|
---|
176 |
|
---|
177 | return dwAttributes & SFGAO_CANRENAME;
|
---|
178 | }
|
---|
179 | return FALSE;
|
---|
180 | }
|
---|
181 |
|
---|
182 | /**************************************************************************
|
---|
183 | * IContextMenu_Constructor()
|
---|
184 | */
|
---|
185 | IContextMenu *IContextMenu_Constructor(LPSHELLFOLDER pSFParent, LPCITEMIDLIST pidl, LPCITEMIDLIST *aPidls, UINT uItemCount)
|
---|
186 | {
|
---|
187 | IContextMenuImpl* cm;
|
---|
188 | UINT u;
|
---|
189 |
|
---|
190 | dprintf(("SHELL32:contmenu:IContectMenu_Constructor(%08xh,%08xh,%08xh)\n",
|
---|
191 | pSFParent,
|
---|
192 | aPidls,
|
---|
193 | uItemCount));
|
---|
194 |
|
---|
195 | cm = (IContextMenuImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IContextMenuImpl));
|
---|
196 | cm->lpvtbl=&cmvt;
|
---|
197 | cm->ref = 1;
|
---|
198 | cm->pidl = ILClone(pidl);
|
---|
199 |
|
---|
200 | cm->pSFParent = pSFParent;
|
---|
201 |
|
---|
202 | if(pSFParent)
|
---|
203 | IShellFolder_AddRef(pSFParent);
|
---|
204 |
|
---|
205 | cm->aPidls = NULL;
|
---|
206 |
|
---|
207 | IContextMenu_AllocPidlTable(cm, uItemCount);
|
---|
208 |
|
---|
209 | if(cm->aPidls)
|
---|
210 | { IContextMenu_FillPidlTable(cm, aPidls, uItemCount);
|
---|
211 | }
|
---|
212 |
|
---|
213 | cm->bAllValues = 1;
|
---|
214 | for(u = 0; u < uItemCount; u++)
|
---|
215 | { cm->bAllValues &= (_ILIsValue(aPidls[u]) ? 1 : 0);
|
---|
216 | }
|
---|
217 | TRACE("(%p)->()\n",cm);
|
---|
218 | shell32_ObjCount++;
|
---|
219 | return (IContextMenu*)cm;
|
---|
220 | }
|
---|
221 |
|
---|
222 | /**************************************************************************
|
---|
223 | * IContextMenu_fnQueryInterface
|
---|
224 | */
|
---|
225 | static HRESULT WINAPI IContextMenu_fnQueryInterface(IContextMenu *iface, REFIID riid, LPVOID *ppvObj)
|
---|
226 | {
|
---|
227 | ICOM_THIS(IContextMenuImpl, iface);
|
---|
228 |
|
---|
229 | char xriid[50];
|
---|
230 | WINE_StringFromCLSID((LPCLSID)riid,xriid);
|
---|
231 |
|
---|
232 | dprintf(("SHELL32:contmenu:IContectMenu_fnQueryInterface(%08xh,%08xh,%08xh,%08xh)\n",
|
---|
233 | This,
|
---|
234 | iface,
|
---|
235 | riid,
|
---|
236 | ppvObj));
|
---|
237 |
|
---|
238 | *ppvObj = NULL;
|
---|
239 |
|
---|
240 | if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/
|
---|
241 | { *ppvObj = This;
|
---|
242 | }
|
---|
243 | else if(IsEqualIID(riid, &IID_IContextMenu)) /*IContextMenu*/
|
---|
244 | { *ppvObj = This;
|
---|
245 | }
|
---|
246 | else if(IsEqualIID(riid, &IID_IShellExtInit)) /*IShellExtInit*/
|
---|
247 | { FIXME("-- LPSHELLEXTINIT pointer requested\n");
|
---|
248 | }
|
---|
249 |
|
---|
250 | if(*ppvObj)
|
---|
251 | {
|
---|
252 | IContextMenu_AddRef((IContextMenu*)*ppvObj);
|
---|
253 | TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);
|
---|
254 | return S_OK;
|
---|
255 | }
|
---|
256 | TRACE("-- Interface: E_NOINTERFACE\n");
|
---|
257 | return E_NOINTERFACE;
|
---|
258 | }
|
---|
259 |
|
---|
260 | /**************************************************************************
|
---|
261 | * IContextMenu_fnAddRef
|
---|
262 | */
|
---|
263 | static ULONG WINAPI IContextMenu_fnAddRef(IContextMenu *iface)
|
---|
264 | {
|
---|
265 | ICOM_THIS(IContextMenuImpl, iface);
|
---|
266 |
|
---|
267 | dprintf(("SHELL32:contmenu:IContectMenu_fnAddRef(%08xh,%08xh,%08xh)\n",
|
---|
268 | This,
|
---|
269 | iface,
|
---|
270 | This->ref));
|
---|
271 |
|
---|
272 | shell32_ObjCount++;
|
---|
273 | return ++(This->ref);
|
---|
274 | }
|
---|
275 |
|
---|
276 | /**************************************************************************
|
---|
277 | * IContextMenu_fnRelease
|
---|
278 | */
|
---|
279 | static ULONG WINAPI IContextMenu_fnRelease(IContextMenu *iface)
|
---|
280 | {
|
---|
281 | ICOM_THIS(IContextMenuImpl, iface);
|
---|
282 |
|
---|
283 | dprintf(("SHELL32:contmenu:IContectMenu_fnRelease(%08xh,%08xh)\n",
|
---|
284 | This,
|
---|
285 | iface));
|
---|
286 |
|
---|
287 | shell32_ObjCount--;
|
---|
288 |
|
---|
289 | if (!--(This->ref))
|
---|
290 | { TRACE(" destroying IContextMenu(%p)\n",This);
|
---|
291 |
|
---|
292 | if(This->pSFParent)
|
---|
293 | IShellFolder_Release(This->pSFParent);
|
---|
294 |
|
---|
295 | if(This->pidl)
|
---|
296 | SHFree(This->pidl);
|
---|
297 |
|
---|
298 | /*make sure the pidl is freed*/
|
---|
299 | if(This->aPidls)
|
---|
300 | { IContextMenu_FreePidlTable(This);
|
---|
301 | }
|
---|
302 |
|
---|
303 | HeapFree(GetProcessHeap(),0,This);
|
---|
304 | return 0;
|
---|
305 | }
|
---|
306 | return This->ref;
|
---|
307 | }
|
---|
308 |
|
---|
309 | /**************************************************************************
|
---|
310 | * ICM_InsertItem()
|
---|
311 | */
|
---|
312 | void WINAPI _InsertMenuItem (
|
---|
313 | HMENU hmenu,
|
---|
314 | UINT indexMenu,
|
---|
315 | BOOL fByPosition,
|
---|
316 | UINT wID,
|
---|
317 | UINT fType,
|
---|
318 | LPSTR dwTypeData,
|
---|
319 | UINT fState)
|
---|
320 | {
|
---|
321 | MENUITEMINFOA mii;
|
---|
322 |
|
---|
323 | dprintf(("SHELL32:contmenu:_InsertMenuItem(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh)\n",
|
---|
324 | hmenu,
|
---|
325 | indexMenu,
|
---|
326 | fByPosition,
|
---|
327 | wID,
|
---|
328 | fType,
|
---|
329 | dwTypeData,
|
---|
330 | fState));
|
---|
331 |
|
---|
332 | ZeroMemory(&mii, sizeof(mii));
|
---|
333 | mii.cbSize = sizeof(mii);
|
---|
334 | if (fType == MFT_SEPARATOR)
|
---|
335 | { mii.fMask = MIIM_ID | MIIM_TYPE;
|
---|
336 | }
|
---|
337 | else
|
---|
338 | { mii.fMask = MIIM_ID | MIIM_TYPE | MIIM_STATE;
|
---|
339 | mii.dwTypeData = dwTypeData;
|
---|
340 | mii.fState = fState;
|
---|
341 | }
|
---|
342 | mii.wID = wID;
|
---|
343 | mii.fType = fType;
|
---|
344 | InsertMenuItemA( hmenu, indexMenu, fByPosition, &mii);
|
---|
345 | }
|
---|
346 | /**************************************************************************
|
---|
347 | * IContextMenu_fnQueryContextMenu()
|
---|
348 | */
|
---|
349 |
|
---|
350 | static HRESULT WINAPI IContextMenu_fnQueryContextMenu(
|
---|
351 | IContextMenu *iface,
|
---|
352 | HMENU hmenu,
|
---|
353 | UINT indexMenu,
|
---|
354 | UINT idCmdFirst,
|
---|
355 | UINT idCmdLast,
|
---|
356 | UINT uFlags)
|
---|
357 | {
|
---|
358 | ICOM_THIS(IContextMenuImpl, iface);
|
---|
359 |
|
---|
360 | BOOL fExplore ;
|
---|
361 |
|
---|
362 | dprintf(("SHELL32:contmenu:IContextMenu_fnQueryContextMenu(%08xh,%08xh,%08xh,%08xh,%08xh)\n",
|
---|
363 | hmenu,
|
---|
364 | indexMenu,
|
---|
365 | idCmdFirst,
|
---|
366 | idCmdLast,
|
---|
367 | uFlags));
|
---|
368 |
|
---|
369 | if(!(CMF_DEFAULTONLY & uFlags))
|
---|
370 | { if(!This->bAllValues)
|
---|
371 | { /* folder menu */
|
---|
372 | fExplore = uFlags & CMF_EXPLORE;
|
---|
373 | /* patch, the MFS_GRAYED items are not implemented yet */
|
---|
374 | if(fExplore)
|
---|
375 | {
|
---|
376 | _InsertMenuItem(hmenu, indexMenu++, TRUE, idCmdFirst+IDM_EXPLORE, MFT_STRING, "&Explore", MFS_GRAYED|MFS_DEFAULT);
|
---|
377 | _InsertMenuItem(hmenu, indexMenu++, TRUE, idCmdFirst+IDM_OPEN, MFT_STRING, "&Open", MFS_ENABLED);
|
---|
378 | }
|
---|
379 | else
|
---|
380 | { _InsertMenuItem(hmenu, indexMenu++, TRUE, idCmdFirst+IDM_OPEN, MFT_STRING, "&Open", MFS_ENABLED|MFS_DEFAULT);
|
---|
381 | _InsertMenuItem(hmenu, indexMenu++, TRUE, idCmdFirst+IDM_EXPLORE, MFT_STRING, "&Explore", MFS_GRAYED);
|
---|
382 | }
|
---|
383 |
|
---|
384 | if(uFlags & CMF_CANRENAME)
|
---|
385 | { _InsertMenuItem(hmenu, indexMenu++, TRUE, 0, MFT_SEPARATOR, NULL, 0);
|
---|
386 | _InsertMenuItem(hmenu, indexMenu++, TRUE, idCmdFirst+IDM_RENAME, MFT_STRING, "&Rename", (IContextMenu_CanRenameItems(This) ? MFS_ENABLED : MFS_DISABLED));
|
---|
387 | }
|
---|
388 | }
|
---|
389 | else /* file menu */
|
---|
390 | { _InsertMenuItem(hmenu, indexMenu++, TRUE, idCmdFirst+IDM_OPEN, MFT_STRING, "&Open", MFS_ENABLED|MFS_DEFAULT);
|
---|
391 | if(uFlags & CMF_CANRENAME)
|
---|
392 | { _InsertMenuItem(hmenu, indexMenu++, TRUE, 0, MFT_SEPARATOR, NULL, 0);
|
---|
393 | _InsertMenuItem(hmenu, indexMenu++, TRUE, idCmdFirst+IDM_RENAME, MFT_STRING, "&Rename", (IContextMenu_CanRenameItems(This) ? MFS_ENABLED : MFS_DISABLED));
|
---|
394 | }
|
---|
395 | }
|
---|
396 | return MAKE_HRESULT(SEVERITY_SUCCESS, 0, (IDM_LAST + 1));
|
---|
397 | }
|
---|
398 | return MAKE_HRESULT(SEVERITY_SUCCESS, 0, 0);
|
---|
399 | }
|
---|
400 |
|
---|
401 | /**************************************************************************
|
---|
402 | * IContextMenu_fnInvokeCommand()
|
---|
403 | */
|
---|
404 | static HRESULT WINAPI IContextMenu_fnInvokeCommand(
|
---|
405 | IContextMenu *iface,
|
---|
406 | LPCMINVOKECOMMANDINFO lpcmi)
|
---|
407 | {
|
---|
408 | ICOM_THIS(IContextMenuImpl, iface);
|
---|
409 |
|
---|
410 | LPITEMIDLIST pidlFQ;
|
---|
411 | SHELLEXECUTEINFOA sei;
|
---|
412 | int i;
|
---|
413 | int iItem;
|
---|
414 | int hwndListView = GetDlgItem(lpcmi->hwnd,ID_LISTVIEW);
|
---|
415 |
|
---|
416 | dprintf(("SHELL32:contmenu:IContextMenu_fnInvokeCommand(%08xh,%08xh,%08xh,%08xh)\n",
|
---|
417 | This,
|
---|
418 | lpcmi,
|
---|
419 | lpcmi->lpVerb,
|
---|
420 | lpcmi->hwnd));
|
---|
421 |
|
---|
422 | if(LOWORD(lpcmi->lpVerb) > IDM_LAST)
|
---|
423 | return E_INVALIDARG;
|
---|
424 |
|
---|
425 | switch(LOWORD(lpcmi->lpVerb))
|
---|
426 | { case IDM_EXPLORE:
|
---|
427 | case IDM_OPEN:
|
---|
428 | /* Find the first item in the list that is not a value. These commands
|
---|
429 | should never be invoked if there isn't at least one folder item in the list.*/
|
---|
430 |
|
---|
431 | for(i = 0; This->aPidls[i]; i++)
|
---|
432 | { if(!_ILIsValue(This->aPidls[i]))
|
---|
433 | break;
|
---|
434 | }
|
---|
435 |
|
---|
436 | pidlFQ = ILCombine(This->pidl, This->aPidls[i]);
|
---|
437 |
|
---|
438 | ZeroMemory(&sei, sizeof(sei));
|
---|
439 | sei.cbSize = sizeof(sei);
|
---|
440 | sei.fMask = SEE_MASK_IDLIST | SEE_MASK_CLASSNAME;
|
---|
441 | sei.lpIDList = pidlFQ;
|
---|
442 | sei.lpClass = "folder";
|
---|
443 | sei.hwnd = lpcmi->hwnd;
|
---|
444 | sei.nShow = SW_SHOWNORMAL;
|
---|
445 |
|
---|
446 | if(LOWORD(lpcmi->lpVerb) == IDM_EXPLORE)
|
---|
447 | { sei.lpVerb = "explore";
|
---|
448 | }
|
---|
449 | else
|
---|
450 | { sei.lpVerb = "open";
|
---|
451 | }
|
---|
452 | ShellExecuteExA(&sei);
|
---|
453 | SHFree(pidlFQ);
|
---|
454 | break;
|
---|
455 |
|
---|
456 | case IDM_RENAME:
|
---|
457 | iItem = ListView_GetNextItem(hwndListView,0, LVNI_FOCUSED);
|
---|
458 | ListView_EditLabelA(hwndListView, iItem);
|
---|
459 | break;
|
---|
460 | }
|
---|
461 | return NOERROR;
|
---|
462 | }
|
---|
463 |
|
---|
464 | /**************************************************************************
|
---|
465 | * IContextMenu_fnGetCommandString()
|
---|
466 | */
|
---|
467 | static HRESULT WINAPI IContextMenu_fnGetCommandString(
|
---|
468 | IContextMenu *iface,
|
---|
469 | UINT idCommand,
|
---|
470 | UINT uFlags,
|
---|
471 | LPUINT lpReserved,
|
---|
472 | LPSTR lpszName,
|
---|
473 | UINT uMaxNameLen)
|
---|
474 | {
|
---|
475 | ICOM_THIS(IContextMenuImpl, iface);
|
---|
476 |
|
---|
477 | HRESULT hr = E_INVALIDARG;
|
---|
478 |
|
---|
479 | dprintf(("SHELL32:contmenu:IContextMenu_fnGetCommandString(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh)\n",
|
---|
480 | This,
|
---|
481 | idCommand,
|
---|
482 | uFlags,
|
---|
483 | lpReserved,
|
---|
484 | lpszName,
|
---|
485 | uMaxNameLen));
|
---|
486 |
|
---|
487 | switch(uFlags)
|
---|
488 | { case GCS_HELPTEXT:
|
---|
489 | hr = E_NOTIMPL;
|
---|
490 | break;
|
---|
491 |
|
---|
492 | case GCS_VERBA:
|
---|
493 | switch(idCommand)
|
---|
494 | { case IDM_RENAME:
|
---|
495 | strcpy((LPSTR)lpszName, "rename");
|
---|
496 | hr = NOERROR;
|
---|
497 | break;
|
---|
498 | }
|
---|
499 | break;
|
---|
500 |
|
---|
501 | /* NT 4.0 with IE 3.0x or no IE will always call This with GCS_VERBW. In This
|
---|
502 | case, you need to do the lstrcpyW to the pointer passed.*/
|
---|
503 | case GCS_VERBW:
|
---|
504 | switch(idCommand)
|
---|
505 | { case IDM_RENAME:
|
---|
506 | lstrcpyAtoW((LPWSTR)lpszName, "rename");
|
---|
507 | hr = NOERROR;
|
---|
508 | break;
|
---|
509 | }
|
---|
510 | break;
|
---|
511 |
|
---|
512 | case GCS_VALIDATE:
|
---|
513 | hr = NOERROR;
|
---|
514 | break;
|
---|
515 | }
|
---|
516 | TRACE("-- (%p)->(name=%s)\n",This, lpszName);
|
---|
517 | return hr;
|
---|
518 | }
|
---|
519 |
|
---|
520 | /**************************************************************************
|
---|
521 | * IContextMenu_fnHandleMenuMsg()
|
---|
522 | * NOTES
|
---|
523 | * should be only in IContextMenu2 and IContextMenu3
|
---|
524 | * is nevertheless called from word95
|
---|
525 | */
|
---|
526 | static HRESULT WINAPI IContextMenu_fnHandleMenuMsg(
|
---|
527 | IContextMenu *iface,
|
---|
528 | UINT uMsg,
|
---|
529 | WPARAM wParam,
|
---|
530 | LPARAM lParam)
|
---|
531 | {
|
---|
532 | ICOM_THIS(IContextMenuImpl, iface);
|
---|
533 |
|
---|
534 | dprintf(("SHELL32:contmenu:IContextMenu_fnHandleMenuMsg(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
|
---|
535 | This,
|
---|
536 | uMsg,
|
---|
537 | wParam,
|
---|
538 | lParam));
|
---|
539 |
|
---|
540 | return E_NOTIMPL;
|
---|
541 | }
|
---|
542 |
|
---|