Start Control Panel windows

Source: Internet
Author: User
First, review how to call external Program :
Delphi uses Windows. winexec or shellapi. ShellExecute to run external programs. For example:

 
Winexec('notepad.exe ', sw_normal); unzip open the unzip winexec('regedit.exe', sw_normal); {open registry editor}

  

The main difference between a DLL file and an EXE file is that the EXE file can be run directly, but the DLL file cannot;
However, in the Win32 system, we can use the system file rundll32.exe to call functions in the DLL;
For example, the following program can open the control panel window:

 
Winexec('rundll32.exe shell32.dll, control_rundll ', sw_normal); // You can simplify (omit the suffix): winexec ('rundll32 shell32, control_rundll', sw_normal ); // sw_normal is the constant of the window opening status option. Its value is 1,CodeConcise and simplified: winexec ('rundll32 shell32, control_rundll ', 1 );

  

In this example:


Code file:
Unit unit1; interfaceuses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, stdctrls; Type tform1 = Class (tform) button1: tbutton; button2: tbutton; example: tbutton; button4: tbutton; button5: tbutton; button6: tbutton; button7: tbutton; example: example; button10: tbutton; button11: tbutton; button12: tbutton; button13: Large; button14: tbutton; button15: tbutton; button16: tbutton; button17: tbutton; button18: tbutton; button19: tbutton; button20: tbutton; button21: tbutton; procedure extract (Sender: tobject); Procedure button2click (Sender: tobject); Procedure extract (Sender: tobject ); procedure alert (Sender: tobject); Procedure button10click (Sender: tobject ); procedure extract (Sender: tobject); Procedure button12click (Sender: tobject); Procedure extract (Sender: tobject ); procedure extract (Sender: tobject); Procedure button17click (Sender: tobject); Procedure extract (Sender: tobject ); procedure button21click (Sender: tobject); end; var form1: tform1; implementation {$ R *. DFM} procedure tform1.button1click (Sender: tobject); begin winexec ('rundll32 shell32, control_rundll ', 1); {control panel} end; Procedure tform1.button2click (Sender: tobject ); begin winexec ('rundll32 shell32, control_rundll access. cpl ', 1); {auxiliary function options} end; Procedure tform1.button3click (Sender: tobject); begin winexec ('rundll32 shell32, control_rundll appwiz. cpl ', 1); {add or delete programs} end; Procedure tform1.button4click (Sender: tobject); begin winexec ('rundll32 shell32, control_rundll desk. cpl ', 1); {display attribute} end; Procedure tform1.button5click (Sender: tobject); begin winexec ('rundll32 shell32, control_rundll firewall. cpl ', 1); {Windows Firewall} end; Procedure tform1.button6click (Sender: tobject); begin winexec ('rundll32 shell32, control_rundll hdwwiz. cpl ', 1); {Add hardware wizard} end; Procedure tform1.button7click (Sender: tobject); begin winexec ('rundll32 shell32, control_rundll inetcpl. cpl ', 1); {Internet attribute} end; Procedure tform1.button8click (Sender: tobject); begin winexec ('rundll32 shell32, control_rundll intl. cpl ', 1); {region and language options} end; Procedure tform1.button9click (Sender: tobject); begin winexec ('rundll32 shell32, control_rundll irprops. cpl ', 1); {wireless link} end; Procedure tform1.button10click (Sender: tobject); begin winexec ('rundll32 shell32, control_rundll joy. cpl ', 1); {game controller} end; Procedure tform1.button11click (Sender: tobject); begin winexec ('rundll32 shell32, control_rundll main. cpl ', 1); {mouse attribute} end; Procedure tform1.button12click (Sender: tobject); begin winexec ('rundll32 shell32, control_rundll mmsys. cpl ', 1); {audio and audio device attributes} end; Procedure tform1.button13click (Sender: tobject); begin winexec ('rundll32 shell32, control_rundll NCPA. cpl ', 1); {network connection} end; Procedure tform1.button14click (Sender: tobject); begin winexec ('rundll32 shell32, control_rundll netsetup. cpl ', 1); {Network Installation Wizard} end; Procedure tform1.button15click (Sender: tobject); begin winexec ('rundll32 shell32, control_rundll nusrmgr. cpl ', 1); {user account} end; Procedure tform1.button16click (Sender: tobject); begin winexec ('rundll32 shell32, control_rundll odbccp32.cpl', 1 ); {ODBC data source Manager} end; Procedure tform1.button17click (Sender: tobject); begin winexec ('rundll32 shell32, control_rundll powercfg. cpl ', 1); {power option attribute} end; Procedure tform1.button18click (Sender: tobject); begin winexec ('rundll32 shell32, control_rundll sysdm. cpl ', 1); {system attribute} end; Procedure tform1.button19click (Sender: tobject); begin winexec ('rundll32 shell32, control_rundll telephon. cpl ', 1); {Telephone and modem options} end; Procedure tform1.button20click (Sender: tobject); begin winexec ('rundll32 shell32, control_rundll wscui. cpl ', 1); {Windows Security Center} end; Procedure tform1.button21click (Sender: tobject); begin winexec ('rundll32 shell32, control_rundll wuaucpl. cpl', 1); {automatic update} end; end.
 
   
 

Form file:

Object form1: tform1 left = 0 Top = 0 caption = 'form1' clientheight = 227 clientwidth = 430 color = clbtnface font. charset = default_charset font. color = clwindowtext font. height =-11 font. name = 'tahoma 'font. style = [] oldcreateorder = false position = podesktopcenter pixelsperinch = 96 textheight = 13 object button1: tbutton left = 8 Top = 8 width = 132 Height = 25 caption = #25511 #21046 #38754 #26495 #31383 #21475 taborder = 0 onclick = button1click end object button2: tbutton left = 8 Top = 39 width = 132 Height = 25 caption = #36741 #21161 #21151 #33021 #36873 #39033 taborder = 1 onclick = button2click end object button3: tbutton left = 8 Top = 70 width = 132 Height = 25 caption = #28155 #21152 #25110 #21024 #38500 #31243 #24207 taborder = 2 onclick = button3click end object button4: tbutton left = 8 Top = 101 width = 132 Height = 25 caption = #26174 #31034 ''#23646 #24615 taborder = 3 onclick = button4click end object button5: tbutton left = 8 Top = 132 width = 132 Height = 25 caption = 'windows' #38450 #28779 #22681 taborder = 4 onclick = button5click end object button6: tbutton left = 8 Top = 163 width = 132 Height = 25 caption = #28155 #21152 #30828 #20214 #21521 #23548 taborder = 5 onclick = button6click end object button7: tbutton left = 8 Top = 194 width = 132 Height = 25 caption = 'internet' #23646 #24615 taborder = 6 onclick = button7click end object button8: tbutton left = 150 top = 8 width = 132 Height = 25 caption = #21306 #22495 #21644 #35821 #35328 #36873 #39033 taborder = 7 onclick = button8click end object button9: tbutton left = 150 top = 39 width = 132 Height = 25 caption = #26080 #32447 #38142 #25509 taborder = 8 onclick = button9click end object button10: tbutton left = 150 top = 70 width = 132 Height = 25 caption = #28216 #25103 #25511 #21046 #22120 taborder = 9 onclick = button10click end object button11: tbutton left = 150 top = 101 width = 132 Height = 25 caption = #40736 #26631 ''#23646 #24615 taborder = 10 onclick = button11click end object button12: tbutton left = 150 top = 132 width = 132 Height = 25 caption = #22768 #38899 #21644 #38899 #39057 #35774 #22791 ''#23646 #24615 taborder = 11 onclick = button12click end object button13: tbutton left = 150 top = 163 width = 132 Height = 25 caption = #32593 #32476 #36830 #25509 taborder = 12 onclick = button13click end object button14: tbutton left = 150 top = 194 width = 132 Height = 25 caption = #32593 #32476 #23433 #35013 #21521 #23548 taborder = 13 onclick = button14click end object button15: tbutton left = 291 Top = 8 width = 132 Height = 25 caption = #29992 #25143 #24080 #21495 taborder = 14 onclick = button15click end object button16: tbutton left = 291 Top = 39 width = 132 Height = 25 caption = 'odbc '#25968 #25454 #28304 #31649 #29702 #22120 taborder = 15 onclick = button16click end object button17: tbutton left = 291 Top = 70 width = 132 Height = 25 caption = #30005 #28304 #36873 #39033 ''#23646 #24615 taborder = 16 onclick = button17click end object button18: tbutton left = 291 Top = 101 width = 132 Height = 25 caption = #31995 #32479 #23646 #24615 taborder = 17 onclick = button18click end object button19: tbutton left = 291 Top = 132 width = 132 Height = 25 caption = #30005 #35805 #21644 #35843 #21046 #35299 #35843 #22120 #36873 #39033 # taborder = 18 onclick = button19click end object button20: tbutton left = 291 Top = 163 width = 132 Height = 25 caption = 'windows' #23433 #20840 #20013 #24515 taborder = 19 onclick = button20click end object button21: tbutton left = 291 Top = 194 width = 132 Height = 25 caption = #33258 #21160 #26356 #26032 taborder = 20 onclick = button21click endend
 
  
 
Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.