Mega Code Archive

 
Categories / Delphi / System
 

How to show the windows display properties tab

Title: How to show the windows display properties tab? Question: The use of 'Rundll32.exe' in windows is very easy using the 'shellexecute' command in Delphi. Make sure 'shellapi' is in your uses list. Answer: function GetSystemDir: TFileName; var SysDir: array [0..MAX_PATH-1] of char; begin SetString(Result, SysDir, GetSystemDirectory(SysDir, MAX_PATH)); if Result = '' then raise Exception.Create(SysErrorMessage(GetLastError)); end; procedure TForm1.Button1Click(Sender: TObject); var x:Tfilename; begin x := getsystemdir; ShellExecute(Form11.Handle, 'open' , Pchar('rundll32.exe') , 'shell32.dll,Control_RunDLL Desk.cpl,@0,3', Pchar(X), SW_normal); end; //getsystemdir is a function that is compatible for all windows versions. ======================================================================= http://www.cliprex.com