Opening Control Panel / Display Properties

From NSIS Wiki
Jump to navigationJump to search
Author: seu (talk, contrib)


How To Use

To open control panel (to let the user change some setting, for example) you can use RUNDLL32.EXE, like this:

Rundll32.exe shell32.dll,Control_RunDLL <contrl>,<applet>, <page>

For Display Properties / Screen Saver the command would be:

Rundll32.exe shell32.dll,Control_RunDLL Desk.cpl,@0, 1

So you can add some section at the end of your script for doing it with the Exec command:

Section "Display Properties"
        Exec 'Rundll32.exe shell32.dll,Control_RunDLL Desk.cpl,@0, 1'
SectionEnd

Others parameters for RunDll32.exe:

 Open Control Panel:                RunDll32.exe shell32.dll,Control_RunDLL
 Add or Remove Programs:            RunDll32.exe shell32.dll,Control_RunDLL appwiz.cpl,,0
 Add or Remove Windows Components:  RunDll32.exe shell32.dll,Control_RunDLL appwiz.cpl,,2
 Windows FireWall:                  RunDll32.exe shell32.dll,Control_RunDLL firewall.cpl
 
 Add a Printer:                     RunDll32.exe SHELL32.DLL,SHHelpShortcuts_RunDLL AddPrinter
 Connect To Printer:                RunDll32.exe WINSPOOL.DRV,ConnectToPrinterDlg
 Open Printers Folder:              RunDll32.exe SHELL32.DLL,SHHelpShortcuts_RunDLL PrintersFolder
 Print a Test Page:                 RunDll32.exe SHELL32.DLL,SHHelpShortcuts_RunDLL PrintTestPage
 
 Share Manager:                     RunDll32.exe NTLANUI.DLL,ShareManage
 
 Properties of the System:          RunDll32.exe shell32.dll,Control_RunDLL sysdm.cpl,,#
 
 Lock WorkStation:                  RunDll32.exe user32.dll,LockWorkStation
 Close Session:                     RunDll32.exe SHELL32.DLL,SHExitWindowsEx 0
 Suspend and hibernate:             RunDll32.exe powrprof.dll,SetSuspendState
 
 Themes:                            RunDll32.exe shell32.dll,Control_RunDLL desk.cpl,,-1
 WallPaper:                         RunDll32.exe shell32.dll,Control_RunDLL desk.cpl,,0
 Appearance:                        RunDll32.exe shell32.dll,Control_RunDLL desk.cpl,,2
 Display Settings                   RunDll32.exe shell32.dll,Control_RunDLL desk.cpl,,3