首页  编辑  

Shell File Menus

Tags: /超级猛料/API.Windows应用程序接口/未公开的API/   Date Created:

All function export form shell32.dll

Creating a Menu

HMENU WINAPI FileMenu_Create(

 COLORREF  crBorderColor,

 int       nBorderWidth,

 HBITMAP   hBorderBmp,

 int       nSelHeight,

 UINT      uFlags); index 114;

hBorderBmp specifies the bitmap to use; nBorderWidth gives the width of the bitmap; and crBorderColor specifies the color used to fill in the area above the bitmap.If you don't want a border, you can just set them all to NULL.The nSelHeight parameter specifies the height of the menu selection bar. You can give any value you want but you would typically just set it to one of the constants in Figure 2. FM_FULL_SELHEIGHT specifies that the selection bar should cover the full height of the menu item. FM_DEFAULT_SELHEIGHT is the same as FM_FULL_SELHEIGHT when using large icons, but with small icons you get a one pixel border on the top and bottom

FM_FULL_SELHEIGHT -1

FM_DEFAULT_SELHEIGHT 0

Figure 2  nSelHeight Constants

The uFlags parameter enables you to choose whether you want large or small icons, and whether the menu should    

wrap onto multiple columns when it is too big to fit on the screen. The latter feature only applies when you're adding files to the menu though. See Figure 3 for a list of the possible flag values.

FMF_SMALL_ICONS 0x00

FMF_LARGE_ICONS 0x08

FMF_NO_COLUMN_BREAK 0x10

Figure 3  Create Flags

Destroying a menu is fortunately a lot

easier. You just call FileMenu_Destroy (the  

FMF_SMALL_ICONS 0x00

FMF_LARGE_ICONS 0x08

FMF_NO_COLUMN_BREAK 0x10

Figure 3  Create Flags

function declaration is also in Figure 1), passing it the handle returned from FileMenu_Create. The ordinal value for FileMenu_Destroy is 118. The ordinal for FileMenu_Create is 114.  

void WINAPI FileMenu_Destroy(HMENU  hMenu); index 118;

BOOL WINAPI FileMenu_AppendItem(HMENU hMenu,LPCSTR lpszText,UINT uID,int iIcon,HMENU hMenuPopup,int ItemHeight); index 115