c#调用系统资源大集合
 
(二)
public static void 打开格式化对话框()
        {
            Process.Start("rundll32.exe"," shell32.dll,SHFormatDrive");
        }
public static void 打开控制面板游戏控制器一般()
        {
            Process.Start("rundll32.exe"," shell32.dll,Control_RunDLL joy.cpl,,0");
        }
public static void 打开控制面板游戏控制器进阶()
        {
            Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL joy.cpl,,1");
        }
public static void 打开控制面板键盘属性速度()
        {
            Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL main.cpl @1");
        }
public static void 打开控制面板键盘属性语言()
        {
            Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL main.cpl @1,,1");
        }
public static void 打开Windows打印机档案夹()
        {
            Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL main.cpl @2");
        }
public static void 打开Windows字体档案夹()
        {
            Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL main.cpl @3");
        }
public static void 打开控制面板输入法属性()
        {
            Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL main.cpl @4");
        }
public static void 打开添加新调制解调器向导()
        {
            Process.Start("rundll32.exe"," shell32.dll,Control_RunDLL modem.cpl,,add");
        }
public static void 打开控制面板多媒体属性音频()
        {
            Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL mmsys.cpl,,0");
        }
public static void 打开控制面板多媒体属性视频()
        {
            Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL mmsys.cpl,,1");
        }
public static void 打开控制面板多媒体属性MIDI()
        {
            Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL mmsys.cpl,,2");
        }
public static void 打开控制面板多媒体属性CD音乐()
        {
            Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL mmsys.cpl,,3");
        }
public static void 打开控制面板多媒体属性设备()
        {
            Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL mmsys.cpl,,4");
        }
public static void 打开控制面板声音()
        {
            Process.Start("rundll32.exe"," shell32.dll,Control_RunDLL mmsys.cpl @1");
        }
public static void 打开控制面板网络()
        {
            Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL netcpl.cpl");
        }
public static void 打开控制面板密码()
        {
            Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL password.cpl");
        }
public static void 打开控制面板电源管理()
        {
            Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL powercfg.cpl");
        }
public static void 打开控制面板区域设置属性区域设置()
        {
            Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL intl.cpl,,0");
        }
public static void 打开控制面板区域设置属性数字选项()
        {
            Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL intl.cpl,,1");
        }
public static void 打开控制面板区域设置属性货币选项()
        {
            Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL intl.cpl,,2");
        }
public static void 打开控制面板区域设置属性时间选项()
        {
            Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL intl.cpl,,3");
        }
public static void 打开控制面板区域设置属性日期选项()
        {
            Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL intl.cpl,,4");
        }
public static void 打开ODBC数据源管理器()
        {
            Process.Start("rundll32.exe"," shell32.dll,Control_RunDLL odbccp32.cpl");
        }
public static void 打开控制面板系统属性常规()
        {
            Process.Start("rundll32.exe"," shell32.dll,Control_RunDLL sysdm.cpl,,0");
        }
public static void 打开控制面板系统属性设备管理器()
        {
            Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL sysdm.cpl,,1");
        }
public static void 打开控制面板系统属性硬件配置()
        {
            Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL sysdm.cpl,,2");
        }
public static void 打开控制面板系统属性性能()
        {
            Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL sysdm.cpl,,3");
        }
自定义执行函数,以便下面调用
        //public static void execute(string dosCommand)
        //{
        //    //创建进程对象
        //    Process dos = new Process();
        //    ProcessStartInfo p = new ProcessStartInfo();
        //    p.FileName = "cmd.exe";
        //    p.Arguments = dosCommand;
        //    //不使用系统外壳程序启动
        //    p.UseShellExecute = false;
        //    //不创建窗口
        //    //p.CreateNoWindow = true;
        //    dos.StartInfo =p;
        //    dos.Start();
        //}
/*shutdown -s -t 3600 -f
        一小时后强行关机 用强行主要怕有些程序卡住 关不了机
        -s 关机
        -r重启
        -f强行
        -t 时间
        -a 取消关机
        -l 注销
        -i 显示用户界面 具体是什么试试就知道了*/
public static void 关闭并重启计算机()
        {
            Process.Start("shutdown.exe", "-r");
        }
public static void 关闭计算机()
        {
            Process.Start("shutdown.exe", "-s -f");
        }
        //重载关闭计算机函数,可以设定倒计时
        public static void 关闭计算机(string time)
        {
            string s = "-s -t " + time;
            Process.Start("shutdown.exe", s);
        }
public static void 注销计算机()
        {
            Process.Start("shutdown.exe", "-l");
        }
public static void 撤销关闭计算机()
        {
            Process.Start("shutdown.exe", "-a");
        }
public static void 打开桌面主旨面板()
        {
            Process.Start("rundll32.exe"," shell32.dll,Control_RunDLL themes.cpl");
        }
public static void 打开网址(string address)
        {
            Process.Start(address);
        }
public static void 运行程序(string name)
        {
            Process .Start (name);
        }
public static void 显示任务栏()
        {
            ShowWindow(FindWindow("Shell_TrayWnd",null),SW_SHOW);
        }
public static void 隐藏任务栏()
        {
            ShowWindow(FindWindow("Shell_TrayWnd",null),SW_HIDE);
        }
public static void 发送邮件(string address)
        {
            string s = "mailto:" + address;
            Process.Start(s);
        }
public static void 发送邮件()
        {           
            Process.Start("mailto:feiyangqingyun@163.com");
        }
public static string 获取系统文件夹()
        {
            string s = Environment.GetFolderPath(Environment.SpecialFolder.System);
            return s;
        }
public static void 打开系统文件夹()
        {
            string s = Environment.GetFolderPath(Environment.SpecialFolder.System);
            Process.Start(s);
        }
public static string 获取ProgramFiles目录()
        {
            string s = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles );
            return s;
        }
public static void 打开ProgramFiles目录()
        {
            string s = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
            Process.Start(s);
        }
public static string 获取逻辑桌面()
        {
            string s = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            return s;
        }
public static void 打开逻辑桌面()
        {
            string s = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            Process.Start(s);
        }
public static string 获取启动程序组()
        {
            string s = Environment.GetFolderPath(Environment.SpecialFolder.Startup);
            return s;
        }
public static void 打开启动程序组()
        {
            string s = Environment.GetFolderPath(Environment.SpecialFolder.Startup);
            Process.Start(s);
        }
public static string 获取Cookies文件夹()
        {
            string s = Environment.GetFolderPath(Environment.SpecialFolder.Cookies);
            return s;
        }
public static void 打开Cookies文件夹()
        {
            string s = Environment.GetFolderPath(Environment.SpecialFolder.Cookies);
            Process.Start(s);
        }
public static string 获取Internet历史文件夹()
        {
            string s = Environment.GetFolderPath(Environment.SpecialFolder.History );
            return s;
        }
public static void 打开Internet历史文件夹()
        {
            string s = Environment.GetFolderPath(Environment.SpecialFolder.History );
            Process.Start(s);
        }
public static string 获取我的电脑文件夹()
        {
            string s = Environment.GetFolderPath(Environment.SpecialFolder.MyComputer );
            return s;
        }
public static void 打开我的电脑文件夹()
        {
            string s = Environment.GetFolderPath(Environment.SpecialFolder.MyComputer );
            Process.Start(s);
        }
public static string 获取MyMusic文件夹()
        {
            string s = Environment.GetFolderPath(Environment.SpecialFolder.MyMusic );
            return s;
        }
public static void 打开MyMusic文件夹()
        {
            string s = Environment.GetFolderPath(Environment.SpecialFolder.MyMusic );
            Process.Start(s);
        }
public static string 获取MyPictures文件夹()
        {
            string s = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures );
            return s;
        }
public static void 打开MyPictures文件夹()
        {
            string s = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures );
            Process.Start(s);
        }
public static string 获取StartMenu文件夹()
        {
            string s = Environment.GetFolderPath(Environment.SpecialFolder.StartMenu );
            return s;
        }
public static void 打开StartMenu文件夹()
        {
            string s = Environment.GetFolderPath(Environment.SpecialFolder.StartMenu );
            Process.Start(s);
        }       
    }
}
写好之后,在窗体的相应事件代码中只需要调用静态方法即可:
调用系统资源.弹出光驱();//需要引入命名空间
是不是很像易语言呢!

转载于:https://blog.51cto.com/wanghai/209816

c#调用系统资源大集合(二)相关推荐

  1. [ 渗透入门篇 ] 渗透行业必备术语大集合(六)

    学渗透是一个漫长的过程,需要掌握的知识点很广,需要心无旁骛地去学. 有关这方面的专业术语有很多很多,我大概是总结了200来个,在这里分享一下. 在连五篇文章介绍完了前面125个: [ 渗透入门篇 ] ...

  2. 大一大二的小设计作品集合(yuan)

    大一大二的小设计作品集合(yuan) 科技作品show

  3. 1、测试诊断软件工具大集合!

    1.测试诊断软件工具大集合! 一. 显卡类: 1. 3DMark 2001 SE Build 330版For Win9x/ME/2000/XP [url]http://file.mydrivers.c ...

  4. 内存地址 哪个程序_记一次排查线上程序内存的忽高忽低,又是大集合惹祸了...

    一:背景 1. 讲故事 昨天继续还技术债,优化一轮后的程序拉到线上后内存继续忽高忽低,低的时候20G,高的时候30G,过了一会又下降了几个G,毫无疑问,程序中有什么集合或者什么操作占用了大量内存,所以 ...

  5. 记一次排查线上程序内存的忽高忽低,又是大集合惹祸了

    一:背景 1. 讲故事 昨天继续还技术债,优化一轮后的程序拉到线上后内存继续忽高忽低,低的时候20G,高的时候30G,过了一会又下降了几个G,毫无疑问,程序中有什么集合或者什么操作占用了大量内存,所以 ...

  6. github开源项目大集合(1)

    github开源项目大集合 目前包括: Android 开源项目第一篇--个性化控件(View)篇  包括ListView.ActionBar.Menu.ViewPager.Gallery.GridV ...

  7. 后端开发(1)---大话后端开发的技巧大集合

    大话后端开发的技巧大集合 模块化设计 根据业务场景,将业务抽离成独立模块,对外通过接口提供服务,减少系统复杂度和耦合度,实现可复用,易维护,易拓展 项目中实践例子: Before: 在返还购APP里有 ...

  8. Python GUI之tkinter窗口视窗教程大集合

    Python GUI之tkinter窗口视窗教程大集合 一.前言 二.Tkinter是什么 三.Tkinter 控件详细介绍 1. Tkinter 模块元素简要说明 2. 常用窗口部件及简要说明: 四 ...

  9. python中tkinter模块窗口操作_Python GUI之tkinter窗口视窗教程大集合(看这篇就够了)...

    本篇博文搬到个人博客:[洪卫の博客](https://sunhwee.com)上面去了,想要获得最佳阅读体验,欢迎前往 [https://sunhwee.com](洪卫の博客), 建议用电脑查看教程文 ...

最新文章

  1. UVa12583 - Memory Overflow
  2. 混凝土静力受压弹性模量试验计算公式_2019年度水运材料考试大纲微试验
  3. 机器人 沈为民_会变形的机器人
  4. CSMAR database query sample
  5. PE文件格式和ELF文件格式(上)----PE文件
  6. 动态规划:LIS优化
  7. Java日期格式化SimpleDateFormat
  8. python笔记小白入门_Python 笔记:全网最详细最小白的Class类和实例详解
  9. 声音存储空间计算公式_声音文件存储量的计算公式
  10. 艾默生黑色无线电池701PBKKF
  11. 【Java项目实战】CRM客户关系管理系统
  12. Kafka 2.8.0 正式发布,增加了哪些新特性?
  13. ChromeDriver与Chrome版本对应关系及下载链接
  14. golang kv存储引擎
  15. 3. LaTeX图片的排版、引用与格式
  16. 机器学习实战之朴素贝叶斯
  17. mysql 时间计算器
  18. Linux没有默认设置root密码
  19. 在Tomcat下部署Jenkins
  20. 计算机桌面上的照片转pdf免费,如何把图片转化为pdf,图片转换pdf工具推荐

热门文章

  1. dubbo分布式服务子系统的划分
  2. 一个过滤器不仅解决了会话标识未更新同时还顺带解决了已解密的登录请求
  3. Vagrant常见问题汇总
  4. Akka Actor Inbox_信箱
  5. linux下DNS服务器的搭建
  6. 网络安装ubuntu操作系统
  7. 大数据分析会遇到哪些误区
  8. 大数据应用智能交通有哪些意义
  9. Mybatis 动态传入order by 参数排序无效
  10. 机器学习初级入门(一)感知机