Adding your program to the Control Panel: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
m (Reverted edits by 193.251.135.118 to last version by Deguix)
Line 5: Line 5:
You have to refresh the Control Panel, if in use, in order to work.
You have to refresh the Control Panel, if in use, in order to work.
Tested only on Windows XP SP2.
Tested only on Windows XP SP2.
== How To Use ==
<highlight-nsis>
${WControlPanelItem_Add} `GUID` `Name` `Tip` `Exec` `Icon`
</highlight-nsis>
; 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.
<highlight-nsis>
${WControlPanelItem_Remove} `GUID`
</highlight-nsis>
; GUID
: Your application GUID used on ''${WControlPanelItem_Add}''.


== The Macros ==
== The Macros ==

Revision as of 15:01, 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.

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.