Launching a Control Panel Applet
   


Use LaunchControlPanelApplet() to launch a control panel applet of your choice. For example, if you wanted to run the display properties from Control Panel, call LaunchControlPanelApplet('Desk.cpl', False). The 'False' parameter tells the function to not wait until the display properties is closed before continuing onto the next line of code. Note: this function uses WinExecAndWait32() and WinExec32().

function LaunchControlPanelApplet(Applet: string; Wait: boolean): boolean;
begin
  if (UpperCase(Copy(Applet, Length(Applet)-3, Length(Applet))) <> '.CPL') and
    (ExtractFileExt(Applet) = '') then
    Applet := Applet + '.cpl';
  if Wait then
    Result := WinExecAndWait32('Rundll32.exe Shell32.dll,Control_RunDLL ' + Applet, SW_SHOWNORMAL) <> -1
  else
    Result := WinExec32('Rundll32.exe Shell32.dll,Control_RunDLL ' + Applet, SW_SHOWNORMAL);
end;


Blue Orb Software

[email protected]