Adding an item to IE context menu: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
No edit summary |
m (fix broken wiki links/syntax) |
||
Line 53: | Line 53: | ||
</highlight-nsis> | </highlight-nsis> | ||
Written by [[beradrian]] | Written by [[{{ns:2}}:beradrian|beradrian]] | ||
[[Category:Code Examples]] | [[Category:Code Examples]] |
Latest revision as of 10:57, 12 May 2017
Author: beradrian (talk, contrib) |
Description
These macros below add or remove items from the Internet Explorer context menu. You have to restart Internet Explorer in order to work. Tested only on Windows XP SP2.
How To Use
${IEMenuItem_Add} `Name` `Exec` `Contexts` `Flags`
- Name
- The title of the item as it appears on the context menu.
- Exec
- File, folder or web page to open when clicking the button. Accepts parameters.
- Contexts
- A logical OR of all the contexts where this item will appear.
- Flags
- If is 0x01 then executing this item will open a new window. Otherwise this is a silent command.
${IEMenuItem_Remove} `Name`
- Name
- The title of the item as it appears on the context menu, the same used with ${IEMenuItem_Add}.
The Macros
!define IE_CONTEXT_MENU_DEFAULT 0x1 !define IE_CONTEXT_MENU_IMAGE 0x2 !define IE_CONTEXT_MENU_CONTROL 0x4 !define IE_CONTEXT_MENU_TABLE 0x8 !define IE_CONTEXT_MENU_TEXTSELECT 0x10 !define IE_CONTEXT_MENU_ANCHOR 0x20 !define IE_CONTEXT_MENU_UNKNOWN 0x40 !define IEMenuItem_KeyName `SOFTWARE\Microsoft\Internet Explorer\MenuExt` !define IEMenuItem_Add `!insertmacro IEMenuItem_Add` !macro IEMenuItem_Add `Name` `Exec` `Contexts` `Flags` WriteRegStr HKCU `${IEMenuItem_KeyName}\${Name}` `` `${Exec}` WriteRegDWORD HKCU `${IEMenuItem_KeyName}\${Name}` `Contexts` ${Contexts} WriteRegDWORD HKCU `${IEMenuItem_KeyName}\${Name}` `Flags` ${Flags} !macroend !define IEMenuItem_Remove `!insertmacro IEMenuItem_Remove` !macro IEMenuItem_Remove `Name` DeleteRegKey HKLM `${IEMenuItem_KeyName}\${Name}` !macroend
Written by beradrian