Call the control panel setting function in the Delphi program

zhaozj2021-02-11  192

In the Delphi program, call the Control Panel Settings the function of the King Army application, sometimes there is a special requirement for the system environment. For example, in the Delphi database application, you may need to set up BDE (BORLAND DATABASE Engine) or ODBC Data Source Name (DSN: Data Source Name); network configuration settings, modem properties settings or user dialings may be required in the network application Connected account and password settings are saved in the system; in the CTI (Computer-Telephony Integration) application, you may need to perform the settings for telephone dialing properties; in the game program, you may need to set the multimedia or game controller; etc. . At this time, you need to change the environmental settings of the Windows system to accommodate the requirements of the normal operation of the application. When the application cannot be able to set up an environment setting, it may be necessary to participate in and assist completion settings.

Most of WIN9X / NT's system settings are performed in the control panel. We can ask the user to open the control panel to find the corresponding project for settings. At this time, the user is required to be quite familiar with the control panel; or the user can automatically open the control panel to the user and select the corresponding item. At this time, the user is only performed. Set. The latter method is undoubtedly more friendly, which can improve the user's work efficiency.

Most of the control panels, all of which correspond to a CPL file in the system directory of Windows, such as the file corresponding to the "Internet" property, the file corresponding to the INETCPL.CPL, "Multimedia" attribute, is mmsys.cpl, etc.. By calling these files, you can open the appropriate property settings window, even skip to the "Connection" property page of the corresponding property page, such as the Internet property, effectively reducing the steps of software users.

The call format of the CPL file is "rundll32.exe shell32.dll, control_rundll cplfile.cpl, item" (see the default value of HKEY_CLASSES_ROOT / CPLFILE / shell / CPLOPEN / COMMAN) in the registry), where cplfile.cpl is a CPL file, ItemNo is the project number. In the Delphi program, you can use the WINEXEC or CREATEPROCESS function to implement the CPL file call to implement the call to the control panel. If the account number and password setting for dial-up connection To call the "Internet" property "Connection" property page, you can use the statement "WINEXEC ('rundll32.exe shell32.dll, control_rundll inetcpl.cpl, 3', sw_shownormal);" Solve the interpretation of the 2000 issue to call the "Regional Settings" property page for the "Regional Settings" property page, you can use statements: "Rundll32.exe shell32.dll, control_rundll intl.cpl, 4 ', 4', Sw_Shownormal); ". The list of statements corresponding to the corresponding statements corresponding to each item setting call:

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

// 32-bit ODBC Data Source Manager, ODBC Data Source, ODBC Driver Setting // No Parameter Distinguished "User DSN" "System DSN" "File DSN" "ODBC Driver" "Track" "About" Six Attributes Page WINEXEC ('Rundll32.exe shell32.dll, control_rundll odbccp32.cpl', sw_shownormal);

// BDE adminstrator // No parameters are provided "Databases" and "Configuration" two property pages WINEXEC ('Rundll_Rundll Bde32.dll, Control_Rundll Bdeadmin.cpl', SW_SHOWNORMAL); // Internet Attribute, there can be ItemNO parameters / / "Routine" Properties page Winexec ('Rundll_Rundll INETCPL32.DLL, CONTROL_RUNDLL INETCPL.CPL, 0', SW_SHOWNORMAL); // "Security" Properties page Winexec ('Rundll32.exe shell32.dll, control_rundll inetcpl.cpl, , 1 ', SW_SHOWNORMAL); // "Content" Property page Winexec (' Rundll_Rundll INETCPL.CPL, 2 ', SW_SHOWNORMAL); // "Connect" 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); // "Advance" attribute Page Winexec ('Rundll32.exe shell32.dll, control_rundll inetcpl.cpl, 5', sw_shownormal);

// Telephone Dial Properties, no parameters distinguish between "My Location" and "Phone Voice Drivers" two property pages WINEXEC ('Rundll_Rundll Telephon.cpl', SW_SHOWNORMAL);

// Power Management Settings, no parameters are provided "Power Scene" and "Advanced" two attribute pages WINEXEC ('Rundll_Rundll PowerCfg.cpl', SW_SHOWNORMAL);

// Modem settings, no parameters are available to "General" and "Diagnostics" two property pages WINEXEC ('Rundll_Rundll Mode32.dll, Control_Rundll Modem.cpl', SW_SHOWNORMAL);

// Multimedia settings, there can be ItemNO parameter // "Audio" property page Winexec ('rundll_rundll mmsys.cpl, 0', sw_shownormal); // "Video" Properties page Winexec ('Rundll32. Exe shell32.dll, control_rundll mmsys.cpl, 1 ', sw_shownormal; // "midi" property page Winexec (' rundll32.exe shell32.dll, control_rundll mmsys.cpl, 2 ', sw_shownormal); // "CD Music "Properties page Winexec ('Rundll_Rundll MMSys.cpl, 3', SW_SHOWNORMAL); //" Device "Properties page Winexec ('Rundll32.exe shell32.dll, control_rundll mmsys.cpl, 4 ', SW_SHOWNORMAL);

// Auxiliary option settings, there can be ItemNO parameter // "Keyboard" property page Winexec ('Rundll_Rundll Access.cpl, 1', sw_shownormal); // "Sound" Properties 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 "Properties page Winexec ('Rundll_Rundll Access.cpl, 4', SW_SHOWNORMAL); //" General "Properties page Winexec ('Rundll32.exe shell32.dll, control_rundll access.cpl, 5 ', Sw_shownormal); // password setting, no parameters distinguish between "Change Password" and "Modify User Configuration" two property pages WINEXEC (' Rundll_Rundll Password.cpl ', SW_SHOWNORMAL);

// Regional setting, there may be items // "Regional Settings" Properties page Winexec ('Rundll_Rundll INTL32.DLL, Control_Rundll INTL.CPL,, 0', SW_SHOWNORMAL); // "Digital" Properties page WINEXEC ('Rundll32 .exe shell32.dll, control_rundll INTL.CPL, 1 ', SW_SHOWNORMAL); // "Currency" Property page Winexec (' Rundll32.exe shell32.dll, control_rundll INTL.CPL, 2 ', sw_shownormal); // " Time "Properties page Winexec ('Rundll_Rundll INTL32.DLL, Control_Rundll INTL.CPL, 3', SW_SHOWNORMAL); //" Date "Properties page Winexec ('Rundll32.exe shell32.dll, control_rundll INTL.CPL, 4 ', SW_SHOWNORMAL);

// Date / Time Settings, there can be ItemNO parameter // "Date and Time" property page Winexec ('rundll32.exe shell32.dll, control_rundll timedate.cpl, 0', sw_shownormal); // "Time Zone" Properties page Winexec ('Rundll32.exe shell32.dll, control_rundll timedate.cpl, 1', sw_shownormal);

// Mouse setting, no parameter distinguishing "button", "pointer", "pointer", three property pages WINEXEC ('Rundll_Rundll Main.cpl', SW_SHOWNORMAL);

// Add / Remove Program Settings, there can be ItemNO parameter // "Install / Uninstall" property page Winexec ('Rundll_Rundll AppWiz.cpl, 1', SW_SHOWNORMAL); // "Windows Installer" Property page WINEXEC ('Rundll32.exe shell32.dll, control_rundll appwiz.cpl, 2', sw_shownormal); // "Start Disk" Properties page Winexec ('Rundll32.exe Shell32.dll, Control_Rundll AppWiz.cpl, 3' , SW_SHOWNORMAL);

// Network settings, no parameter distinction "configuration", "identity", "ID", three property pages, WINEXEC ('Rundll_Rundll Netcpl.cpl', SW_SHOWNORMAL); // System Settings, / / "Regular" property page, you can have itemno parameters Winexec ('Rundll_Rundll Shell32.dll, Control_Rundll Sysdm.cpl, 0', SW_SHOWNORMAL); // "Device Manager" Properties page Winexec ('Rundll32.exe shell32. DLL, Control_Rundll Sysdm.cpl, 1 ', SW_SHOWNORMAL); // "Hardware Profile" Properties page WINEXEC (' Rundll32.exe shell32.dll, control_rundll sysdm.cpl, 2 ', sw_shownormal); // "Performance" Properties page Winexec ('Rundll32.exe shell32.dll, control_rundll sysdm.cpl, 3', sw_shownormal);

// Display settings, there can be ItemNO parameter // "Background" property page Winexec ('Rundll_Rundll Desk.cpl, 0', SW_SHOWNORMAL); // "Screen Sword" Properties page WINEXEC (' Rundll32.exe shell32.dll, control_rundll desk.cpl, 1 ', sw_shownormal; // "Appearance" Properties page Winexec (' Rundll32.exe shell32.dll, control_rundll desk.cpl, 2 ', sw_shownormal); // Settings Properties page Winexec ('Rundll32.exe shell32.dll, control_rundll desk.cpl, 3', sw_shownormal);

// Game controller settings, there can be 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 parameters distinguish "devices" and "record settings" two property pages WINEXEC ('rundll_rundll sticpl.cpl', sw_shownormal);

The above program is debugged under PWIN98 Delphi3.0.

转载请注明原文地址:https://www.9cbs.com/read-3959.html

New Post(0)