Fast Explorer Context Menu Extension DLL
Quote:
This handy utility allows you to manage context menus items of file objects displayed in a file manager like Windows Explorer or any other application that deals with shell's application programming interface. It's a very simple way to make your often used file actions quickly accessible.
Fast Explorer handles both static and dynamic context menu items and can assist with even more...
With Fast Explorer you can create new context menu items, submenus (cascaded menus), dividers, and optionally specify menu bitmaps and hint text.
For an ultimate control over dynamic context menu items added from within Fast Explorer you can define your own look & feel using the custom-drawing feature.
Fast Explorer-driven context menu items can be associated with any file type registered in Windows shell, including the wide range of predefined shell objects:
All files; All files and file folders; All non-associated files; All folders; All file folders; File folder background; Entire network; All network shares; All network servers; All printers; All drives; Audio CD in drive; DVD drive
and a set of perceived types, like Image, Text, Audio, Video, Compressed, or System.
You'll need to place the FEShlExt.dll in the script-directory (download
here, feredist.zip)
Documentation
Example:
Code:
#include FE.ahk
#singleInstance force
;load the COM dll
;set autobuild on: builds the menu everytime sth changes
FE_load(true)
;add root item, make it a submenu
;FE_addItem(id,parent,submenu,application,parameters,caption,hint,iconfile,iconindex,checked,filetype)
rNo := FE_addItem("root",0,1,"","","Test Context Menu","","shell32.dll",24,1,"*")
;add items to the root menu
FE_addItem("deleteme","root",0,A_WinDir "\regedit.exe","", "Registry Editor", "", "", 0,1,"*")
FE_addItem("hex",rNo,0,A_WinDir "\notepad.exe","`%1", "Notepad", "", "notepad.exe",0,1,"*")
;add custom Settings
FE_addCustomSetting("Enabled","true")
FE_addCustomSetting("FirstLevelDefault","true")
FE_addCustomSetting("BackgroundFix","true")
FE_addDebugSetting("DebugLogging","false")
;delete one item
FE_deleteItem("deleteme")
;build the menu, not needed if autobuild is turned on
;FE_buildMenu()
return
#9::
OnExit:
FE_unload()
ExitApp
QuickHelp:
Code:
"Parent" specifies a parent menu item (submenu) that this item belongs to;
"Application" holds a full path to an application associated with the context menu item;
"Parameters" specifies application parameters, for example: %1;
"Caption" is a display name of this context menu item;
"Hint" holds a descriptive text displayed in status bar of Windows Explorer;
"IconFile" points to an executable (binary) or an image file that holds the menu item icon (for example, .EXE, .DLL, .ICO or .PNG files);
"IconIndex" is 0 for an image file or specifies an icon index for a binary file;
"Checked" can be set to 0 to hide this menu item and its child items (if any);
"FileType" specifies a Registry key name that identifies the file type this menu item is displayed for.
CustomOptionsCode:
Enabled=<False|True>
FirstLevelDefault=<False|True>
BackgroundFix=<False|True>
TextIndent=<number, pixel>
TextFontFace=<fontname>
TextFontSize=<number>
NormalTextColor=<colorId>
SelectedTextColor=<colorId>
NormalBackColor=<colorId>
SelectedBackColor=<colorId>
NormalIconBackColor=<colorId>
SelectedIconBackColor=<colorId>
"Enabled" can be set to False if FEShlExt.dll should ignore these settings;
if "FirstLevelDefault" is True, the look & feel settings won't be applied to menu items displayed in the top level context menu;
"BackgroundFix" specifies that a workaround fix should be applied for displaying context menu items for the "File folder background" file type; it's recommended to set it to True;
"TextIndent" specifies in pixels an indent of caption text from the left;
"TextFontFace" specifies a menu item font; if its value is empty, the default font is used;
"TextFontSize" specifies a menu item font size; if it's empty, you know what;
Color-properties are used to customize colors of particular menu item parts; the colorId value has $BBGGRR format, while $20000000 means default color.
FE.ahkCode:
FE_load(autobuild=false)
{
Global FE_Autobuild
FE_Autobuild := autobuild
Run, regsvr32 "%A_ScriptDir%\FEShlExt.dll" /s
}
FE_unload()
{
Run, regsvr32 "%A_ScriptDir%\FEShlExt.dll" /u /s
}
FE_addItem(id,parent,submenu,application,parameters,caption,hint,iconfile,iconindex,checked,filetype)
{
Global
itemCnt++
item[%id%] := itemCnt
item[%itemCnt%]ID := id
if parent is not integer
{
parent := item[%parent%]
}
item[%itemCnt%]Parent := Parent
item[%itemCnt%]Application := Application
item[%itemCnt%]Parameters := Parameters
item[%itemCnt%]Caption := Caption
item[%itemCnt%]Hint := Hint
item[%itemCnt%]IconFile := IconFile
item[%itemCnt%]IconIndex := IconIndex
item[%itemCnt%]Checked := Checked
item[%itemCnt%]FileType := FileType
item[%itemCnt%]SubMenu := SubMenu
if FE_Autobuild
FE_buildMenu()
return % itemCnt
}
FE_deleteItem(id)
{
Global
no := item[%id%]
if no !=
{
Loop, % itemCnt - no
{
i := A_Index + no
j := i-1
FE_int_copyItem(i,j)
}
itemCnt--
}
if FE_Autobuild
FE_buildMenu()
}
FE_int_copyItem(from,to)
{
Global
local tList
tList = ID,Parent,Application,Caption,Hint,IconFile,IconIndex,Checked,FileType,SubMenu
Loop, parse, tList, `,
{
it := item[%from%]%A_LoopField%
item[%to%]%A_LoopField% := it
}
}
FE_addCustomSetting(option,value)
{
Global
csCnt++
cs[%csCnt%]Option := option
cs[%csCnt%]Value := value
if FE_Autobuild
FE_buildMenu()
}
FE_addDebugSetting(option,value)
{
Global
dsCnt++
ds[%dsCnt%]Option := option
ds[%dsCnt%]Value := value
if FE_Autobuild
FE_buildMenu()
}
FE_buildMenu()
{
Global
local iniFile, i, section, tList, tOption, tValue
iniFile = %A_ScriptDir%\FastExplorer.ini
FileDelete, %iniFile%
section = Dynamic Items
Loop, %itemCnt%
{
i := A_Index
tList = Parent,Application,Caption,Hint,IconFile,IconIndex,Checked,FileType,SubMenu
Loop, parse, tList, `,
{
it := item[%i%]%A_LoopField%
IniWrite, %it%, %iniFile%, %section%, %A_LoopField%%i%
}
}
IniWrite, %itemCnt%, %iniFile%, %section%, Count
section = Custom-drawn Menu Properties
Loop, %csCnt%
{
i := A_Index
tOption := cs[%i%]Option
tValue := cs[%i%]Value
IniWrite, %tValue%, %iniFile%, %section%, %tOption%
}
section = Debug Options
Loop, %dsCnt%
{
i := A_Index
tOption := ds[%i%]Option
tValue := ds[%i%]Value
IniWrite, %tValue%, %iniFile%, %section%, %tOption%
}
}
Inspired by
this thread