- using System;
- using System.Diagnostics;
- using System.Runtime.InteropServices;
- namespace PlatForm.Utilities
- {
- /// <summary>
- /// DosHelper
- /// Dos常用操作类
- /// </summary>
- public class DosHelper
- {
- //引入API函数
- [DllImportAttribute("user32.dll")]
- private static extern int FindWindow(string ClassName, string WindowName);
- [DllImport("user32.dll")]
- private static extern int ShowWindow(int handle, int cmdShow);
- [DllImport("winmm.dll", EntryPoint = "mciSendString", CharSet = CharSet.Auto)]
- private static extern int mciSendString(string lpstrCommand, string lpstrReturnstring, int uReturnLength, int hwndCallback);
- public void 打开复制软碟窗口()
- {
- Process.Start("rundll32.exe", " diskcopy.dll,DiskCopyRunDll");
- }
- public void 打开新建拨号连接()
- {
- Process.Start("rundll32.exe", " rnaui.dll,RnaWizard");
- }
- public void 打开显示属性背景()
- {
- Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL desk.cpl,,0");
- }
- public void 打开显示属性屏幕保护()
- {
- Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL desk.cpl,,1");
- }
- public void 打开显示属性外观()
- {
- Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL desk.cpl,,2");
- }
- public void 打开显示属性属性()
- {
- Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL desk.cpl,,3");
- }
- public void 打开格式化对话框()
- {
- Process.Start("rundll32.exe", " shell32.dll,SHFormatDrive");
- }
- public void 打开控制面板游戏控制器一般()
- {
- Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL joy.cpl,,0");
- }
- public void 打开控制面板游戏控制器进阶()
- {
- Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL joy.cpl,,1");
- }
- public void 打开控制面板键盘属性速度()
- {
- Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL main.cpl @1");
- }
- public void 打开控制面板键盘属性语言()
- {
- Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL main.cpl @1,,1");
- }
- public void 打开Windows打印机档案夹()
- {
- Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL main.cpl @2");
- }
- public void 打开Windows字体档案夹()
- {
- Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL main.cpl @3");
- }
- public void 打开控制面板输入法属性()
- {
- Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL main.cpl @4");
- }
- public void 打开添加新调制解调器向导()
- {
- Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL modem.cpl,,add");
- }
- public void 打开控制面板多媒体属性音频()
- {
- Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL mmsys.cpl,,0");
- }
- public void 打开控制面板多媒体属性视频()
- {
- Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL mmsys.cpl,,1");
- }
- public void 打开控制面板多媒体属性MIDI()
- {
- Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL mmsys.cpl,,2");
- }
- public void 打开控制面板多媒体属性CD音乐()
- {
- Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL mmsys.cpl,,3");
- }
- public void 打开控制面板多媒体属性设备()
- {
- Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL mmsys.cpl,,4");
- }
- public void 打开控制面板声音()
- {
- Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL mmsys.cpl @1");
- }
- public void 打开控制面板网络()
- {
- Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL netcpl.cpl");
- }
- public void 打开控制面板密码()
- {
- Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL password.cpl");
- }
- public void 打开控制面板电源管理()
- {
- Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL powercfg.cpl");
- }
- public void 打开控制面板区域设置属性区域设置()
- {
- Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL intl.cpl,,0");
- }
- public void 打开控制面板区域设置属性数字选项()
- {
- Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL intl.cpl,,1");
- }
- public void 打开控制面板区域设置属性货币选项()
- {
- Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL intl.cpl,,2");
- }
- public void 打开控制面板区域设置属性时间选项()
- {
- Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL intl.cpl,,3");
- }
- }
- }
- //该片段来自于http://www.codesnippet.cn/detail/230720134754.html
来源: http://www.codesnippet.cn/detail/230720134754.html