For Newbie

Tuesday, 15 November 2011

Execution Control Panel Applet delphi


Mengesksekusi Tricks Windows XP Control Panel applet. Such as: System Properties, Date and Time Properties, ODBC Data Source Administrator, etc..
You can use the ShellExecute function.Location Control Panel applet file is located at% SystemRoot% / System32 /, so that when executing the applet file, FileName parameter is filled with just the file name (eg: "sysdm.cpl"). While the applet is an extension of the file: *. cpl *.
Here is a Control Panel applet and the file name:Accessibility Options - access.cplAdd Hardware Wizard - hdwwiz.cplAdd or Remove Programs - appwiz.cplDisplay Properties - desk.cplGame Controllers - joy.cplInternet Properties - inetcpl.cplMouse Properties - main.cplNetwork Connections - ncpa.cplODBC Data Source Administrator - odbccp32.cplPhone and Modem Options - telephon.cplPower Options Properties - powercfg.cplRegion and Language Options - intl.cplSound and Audio Devices - mmsys.cplSystem Properties - sysdm.cplTime and Date Properties - timedate.cplUser Accounts - nusrmgr.cpl
Example # 1 (execute Time and Date Properties):procedure TForm1.Button1Click (Sender: TObject);begin
  
ShellExecute (Handle, nil, 'timedate.cpl', nil, nil, SW_SHOWNORMAL);end;
Example # 2 (execute the Display Properties):procedure TForm1.Button1Click (Sender: TObject);begin
  
ShellExecute (Handle, nil, 'desk.cpl', nil, nil, SW_SHOWNORMAL);end;
Example # 3 (implementation in source code):const
  
FileCPL: array [1 .. 5] of String = ('desk.cpl', 'sysdm.cpl', 'timedate.cpl',
                                     
'Appwiz.cpl', 'odbccp32.cpl');
TForm1.FormCreate procedure (Sender: TObject);begin
  
with ComboBox1 do
  
begin
    
Items.Add ('Display Properties');
    
Items.Add ('System Properties');
    
Items.Add ('Time and Date Properties');
    
Items.Add ('Add or remove programs');
    
Items.Add ('ODBC Data Source Administrator');
    
ItemIndex: = 0;
  
end;end;
procedure TForm1.Button1Click (Sender: TObject);begin
  
ShellExecute (Handle, nil, PChar (FileCPL [ComboBox1.ItemIndex + 1]),
               
nil, nil, SW_SHOWNORMAL);end;
*) Add the units ShellAPI the uses clause.

Share on Facebook
Share on Twitter
Share on Google+

Related : Execution Control Panel Applet delphi