访问量: 34578次,访客数: 29606人,浏览量: 1次 
首页  编辑  

how to pop up shell menu

Tags: /超级猛料/Stream.File.流、文件和目录/Shell操作/   Date Created: Tue Jun 04 2002 12:22:43 GMT+0000 (Coordinated Universal Time)

how to pop up shell menu

Take a look at the interface IContextMenu. Here are the steps you need

to do:

- Get such an interface from a shell folder by calling

IShellFolder.GetUIObjectOf().

- Create a menu handle (use Windows.CreateMenu)

- Call IContextMenu.QueryContextMenu() passing the menu handle you

created so that the object populates the windows menu with all items.

- Use TrackPopupMenu() or TrackPopupMenuEx() to display the menu.

Specify the flag TPM_RETURNCMD so that the function returns the

command id of the item the user selected (typecast the result of

TrackPopupMenu to a DWORD).

- Use IContextMenu.InvokeCommand() to invoke the selected command id

on the shell object.