Adding your program to the Control Panel: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
m (Added category links.)
m (Reverted edits by 111.95.154.125 to last version by Kichik)
 
(5 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{|align=right
{{PageAuthor|ZmAn3}}
|<small>Author: [[{{ns:2}}:ZmAn3|ZmAn3]] ([[{{ns:3}}:ZmAn3|talk]], [[{{ns:-1}}:Contributions/ZmAn3|contrib]])</small>
 
|}
<br style="clear:both;">
== Description ==
== Description ==
These macros below add or remove items from the Control Panel.
These macros below add or remove items from the Control Panel.
Line 54: Line 52:
Modified by [[User:deguix|deguix]].
Modified by [[User:deguix|deguix]].


[[{{ns:14}}:Windows Shell Integration Functions]]
[[Category:System Related Functions]]

Latest revision as of 17:04, 22 March 2013

Author: ZmAn3 (talk, contrib)


Description

These macros below add or remove items from the Control Panel. You have to refresh the Control Panel, if in use, in order to work. Tested only on Windows XP SP2.

How To Use

${WControlPanelItem_Add} `GUID` `Name` `Tip` `Exec` `Icon`
GUID
Your application GUID. If you don't have one, use the function from Create a GUID, a Globally Unique Identifier page.
Name
Name of the item to appear as the button name.
Exec
File to open when executing the item. It has to be an executable. Accepts parameters.
Icon
Specifies the icon to be used for the item.
${WControlPanelItem_Remove} `GUID`
GUID
Your application GUID used on ${WControlPanelItem_Add}.

The Macros

!define WControlPanelItem_Add `!insertmacro WControlPanelItem_Add`
!macro WControlPanelItem_Add `GUID` `Name` `Tip` `Exec` `Icon`
  WriteRegStr HKCR `CLSID\${GUID}` `` `${Name}`
  WriteRegStr HKCR `CLSID\${GUID}` `InfoTip` `${Tip}`
  WriteRegStr HKCR `CLSID\${GUID}\DefaultIcon` `` `${Icon}`
  WriteRegStr HKCR `CLSID\${GUID}\Shell\Open\Command` `` `${Exec}`
  WriteRegDWORD HKCR `CLSID\${GUID}\ShellFolder` `Attributes` `0`
  WriteRegStr HKLM `SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ControlPanel\NameSpace\${GUID}` `` `${Name}`
!macroend
 
!define WControlPanelItem_Remove `!insertmacro WControlPanelItem_Remove`
!macro WControlPanelItem_Remove `GUID`
  DeleteRegKey HKCR "CLSID\${GUID}"
  DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ControlPanel\NameSpace\${GUID}"
!macroend

Written by ZmAn3.
Modified by deguix.