Delphi: open a .cpl

Question

how open a .cpl???
example desk.cpl (display property)


webmaster Guido :

As with any other file that you want to open with its associated program, you can use:

ShellExecute(Handle, 'open', PointerToProgram, PointerToFile, nil, SWFlag);  

In your case, this gives:

AProgram := 'c:\windows\control.exe';
AFile := 'c:\windows\system\desk.cpl';
ShellExecute(Handle, 'open', PChar(AProgram), PChar(AFile), nil, SW_SHOW);  

SW_SHOW means: show the window, as opposed to SW_HIDE.

You can find more info in DelphiLand's source code section (just click the navigation button "Source snips") under "Running an external application".