Beranda > Delphi > Launching a Control Panel Applet

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;

Iklan
Kategori:Delphi
  1. Belum ada komentar.
  1. No trackbacks yet.

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: