Call the Control Panel setting function in the Delphi Program

Source: Internet
Author: User
Tags dsn intl

Call the Control Panel setting function in the Delphi Program
Wang fa-jun

When an application is running, you sometimes need to have special requirements on the system environment. For example, you may need to set BDE (borland database engine) or ODBC Data Source Name (DSN: Data Source Name) in the Delphi Database Application; in network applications, you may need to set network configuration, modem properties, or set the account and password of the user's dial-up connection, and save the settings in the system. In CTI (computer-telephony integration) in the application, you may need to set the dialing property; in the game program, you may need to set the multimedia or game controller; and so on. At this time, you need to change the Windows system environment settings to meet the normal operation requirements of applications. When the application cannot set the environment on its own, the software user may be required to participate in and assist in completing the settings.

Most system settings of Win9x/NT are performed on the control panel. We can ask the user to open the control panel and find the corresponding project for setting. At this time, the user is required to be quite familiar with the control panel; you can also automatically open the control panel for the user in the program and select the corresponding project. In this case, all you do is set. The latter method is undoubtedly more friendly and more efficient for users.

Most project settings on the control panel correspond to a CPL file under the Windows System directory. For example, the file corresponding to the "Internet" attribute is inetcpl. the file corresponding to the CPL and multimedia attributes is mmsys. cpl. By calling these files, you can open the corresponding property settings window, or even jump to the corresponding property page, such as the "connection" property page of the "Internet" property, to effectively reduce the operation steps of software users.

The cplfile format is javasrundll32.exe shell32.dll and control_rundll cplfile. CPL, itemno "(see the default value of hkey_classes_root/cplfile/Shell/cplopen/command in the registry), where cplfile. CPL is the CPL file, and itemno is the project number. In the Delphi program, you can use the winexec or CreateProcess function to call the CPL file, so as to call the Control Panel setting project. Unzip shell32.dll, control_rundll inetcpl. CPL, 3', sw_shownormal); "; to resolve the 2000 problem, the" date "attribute page of" region Settings "must be called for the two-year input explanation. You can use the statement: “winexec('rundll32.exe shell32.dll, control_rundll intl. CPL, 4', sw_shownormal );".
The following table lists the statements used to call the settings of each project in the control panel:

// Open the control panel
Winexec('rundll.exe shell32.dll, control_rundll ', sw_shownormal );

// 32-bit ODBC data source Manager, ODBC data source, ODBC driver settings
// No parameter is provided to distinguish "User DSN" "system DSN" "file DSN" "ODBC driver" "trace" "about" Six attribute pages
Winexec('rundll32.exe shell32.dll, control_rundll odbccp32.cpl ', sw_shownormal );

// BDE Adminstrator
// There Are No attribute pages for Parameter Differentiation "databases" and "configuration"
Winexec('rundll32.exe shell32.dll, control_rundll bdeadmin. Cpl ', sw_shownormal );

// Internet attribute, which can have the itemno Parameter
// "General" property page
Winexec('rundll32.exe shell32.dll, control_rundll inetcpl. CPL, 0', sw_shownormal );
// "Security" property page
Winexec('rundll32.exe shell32.dll, control_rundll inetcpl. CPL, 1', sw_shownormal );
// "Content" attribute page
Winexec('rundll32.exe shell32.dll, control_rundll inetcpl. CPL, 2', sw_shownormal );
// "Connection" property page
Winexec('rundll32.exe shell32.dll, control_rundll inetcpl. CPL, 3', sw_shownormal );
// "Program" property page
Winexec('rundll32.exe shell32.dll, control_rundll inetcpl. CPL, 4', sw_shownormal );
// "Advanced" property page
Winexec('rundll32.exe shell32.dll, control_rundll inetcpl. CPL, 5', sw_shownormal );

// Dialing property. No parameter is provided to distinguish between "My location" and "telephone voice driver ".
Winexec('rundll32.exe shell32.dll, control_rundll telephon. Cpl ', sw_shownormal );

// Power management settings. Parameter Differentiation Between "power solution" and "advanced" is not provided
Winexec('rundll32.exe shell32.dll, control_rundll powercfg. Cpl ', sw_shownormal );

// Modem settings, no Parameter Differentiation "general" or "diagnosis" attribute pages are provided
Winexec('rundll32.exe shell32.dll, control_rundll MODEM. Cpl ', sw_shownormal );

// Multimedia settings, which can have the itemno Parameter
// "Audio" attribute page
Winexec('rundll32.exe shell32.dll, control_rundll mmsys. CPL, 0', sw_shownormal );
// "Video" attribute page
Winexec('rundll32.exe shell32.dll, control_rundll mmsys. CPL, 1', sw_shownormal );
// "Midi" attribute page
Winexec('rundll32.exe shell32.dll, control_rundll mmsys. CPL, 2', sw_shownormal );
// "CD music" property page
Winexec('rundll32.exe shell32.dll, control_rundll mmsys. CPL, 3', sw_shownormal );
// "Device" property page
Winexec('rundll32.exe shell32.dll, control_rundll mmsys. CPL, 4', sw_shownormal );

// Auxiliary option settings, which can have the itemno Parameter
// "Keyboard" property page
Winexec('rundll32.exe shell32.dll, control_rundll access. CPL, 1', sw_shownormal );
// "Sound" attribute page
Winexec('rundll32.exe shell32.dll, control_rundll access. CPL, 2', sw_shownormal );
// "Display" property page
Winexec('rundll32.exe shell32.dll, control_rundll access. CPL, 3', sw_shownormal );
// "Mouse" property page
Winexec('rundll32.exe shell32.dll, control_rundll access. CPL, 4', sw_shownormal );
// "General" property page
Winexec('rundll32.exe shell32.dll, control_rundll access. CPL, 5', sw_shownormal );

// Set the password. No parameter is provided to distinguish "Change Password" from "Modify user configuration ".
Winexec('rundll32.exe shell32.dll, control_rundll password. Cpl ', sw_shownormal );

// Set the region. The itemno parameter is allowed.
// "Region Settings" property page
Winexec('rundll32.exe shell32.dll, control_rundll intl. CPL, 0', sw_shownormal );
// "Number" attribute page
Winexec('rundll32.exe shell32.dll, control_rundll intl. CPL, 1', sw_shownormal );
// "Currency" attribute page
Winexec('rundll32.exe shell32.dll, control_rundll intl. CPL, 2', sw_shownormal );
// "Time" property page
Winexec('rundll32.exe shell32.dll, control_rundll intl. CPL, 3', sw_shownormal );
// "Date" property page
Winexec('rundll32.exe shell32.dll, control_rundll intl. CPL, 4', sw_shownormal );

// Date/time setting, which can have the itemno Parameter
// "Date and Time" attribute page
Winexec('rundll32.exe shell32.dll, control_rundll TimeDate. CPL, 0 ', sw_shownormal );
// "Time Zone" property page
Winexec('rundll32.exe shell32.dll, control_rundll TimeDate. CPL, 1', sw_shownormal );

// The mouse setting does not provide three property pages for parameter differences: "button", "Pointer", and "move"
Winexec('rundll32.exe shell32.dll, control_rundll main. Cpl ', sw_shownormal );

// Add/delete program settings. The itemno parameter is allowed.
// "Install/uninstall" property page
Winexec('rundll32.exe shell32.dll, control_rundll appwiz. CPL, 1', sw_shownormal );
// "Windows Installer" property page
Winexec('rundll32.exe shell32.dll, control_rundll appwiz. CPL, 2', sw_shownormal );
// "Boot disk" attribute page
Winexec('rundll32.exe shell32.dll, control_rundll appwiz. CPL, 3', sw_shownormal );

// Network settings. There are no attribute pages for parameter differences: "configuration", "Identity", and "Access Control ".
Winexec('rundll32.exe shell32.dll, control_rundll netcpl. Cpl ', sw_shownormal );

// System settings,
// "General" property page, which can have the itemno Parameter
Winexec('rundll32.exe shell32.dll, control_rundll sysdm. CPL, 0', sw_shownormal );
// "Device Manager" property page
Winexec('rundll32.exe shell32.dll, control_rundll sysdm. CPL, 1', sw_shownormal );
// "Hardware configuration file" property page
Winexec('rundll32.exe shell32.dll, control_rundll sysdm. CPL, 2', sw_shownormal );
// "Performance" attribute page
Winexec('rundll32.exe shell32.dll, control_rundll sysdm. CPL, 3', sw_shownormal );

// Display settings, which can have the itemno Parameter
// "Background" property page
Winexec('rundll32.exe shell32.dll, control_rundll desk. CPL, 0 ', sw_shownormal );
// "Screen Saver" property page
Winexec('rundll32.exe shell32.dll, control_rundll desk. CPL, 1', sw_shownormal );
// "Appearance" property page
Winexec('rundll32.exe shell32.dll, control_rundll desk. CPL, 2', sw_shownormal );
// "Settings" property page
Winexec('rundll32.exe shell32.dll, control_rundll desk. CPL, 3', sw_shownormal );

// Game controller settings, which can have the itemno Parameter
// "General" property page
Winexec('rundll32.exe shell32.dll, control_rundll joy. CPL, 0', sw_shownormal );
// "Advanced" property page
Winexec('rundll32.exe shell32.dll, control_rundll joy. CPL, 1', sw_shownormal );

// Scanner and digital camera settings, no Parameter Differentiation Between "device" and "record settings" are provided
Winexec('rundll32.exe shell32.dll, control_rundll sticpl. Cpl ', sw_shownormal );

The above program is successfully debugged under pwin98 + Delphi3.0.

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.