Mega Code Archive

 
Categories / Delphi / Examples
 

Start an applet from the control panel [display properties ]

Are you looking for a way to start Control Panel applets from your application without opening the Control Panel? For example to let the user set display properties or the time/ date? Look in your \Windows\System (NT: \System32) directory to find out the names of the applet - each applet corresponds to a .CPL file which is practically a DLL. The function StartApplet() in the following code starts a given applet; the sample brings up the "Display Properties" dialog: Program AppletDemo; Uses SysUtils, Windows; function StartApplet(app : String): integer; var cCmd : array [0..1023] of char; begin StrPCopy (cCmd, 'rundll32.exe shell32.dll,Control_RunDLL ' + app); Result := WinExec (cCmd, SW_SHOWNORMAL); end; begin StartApplet ('desk.cpl'); end.