加入收藏 - 网站地图 - 网站搜索 -
阅读新闻

C#调用系统文件

[日期:01-10] [字体: ]
 static void Main()
  {
   Application.Run(new Form1());
  }
  [DllImport("kernel32.dll")]
  public static extern bool WinExec(string CmdLine,int uCmdShow);                 
  public const int SW_RESTORE=9;
  private void button1_Click(object sender, System.EventArgs e)
  {//启动控制面板
    WinExec("rundll32.exe shell32.dll,Control_RunDLL",SW_RESTORE);  
  }
  private void button2_Click(object sender, System.EventArgs e)
  {//启动显示属性\桌面
     WinExec("rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,0",SW_RESTORE);
  }
  private void button3_Click(object sender, System.EventArgs e)
  {//启动显示属性\屏幕保护程序
    WinExec("rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,1",SW_RESTORE); 
  }

  private void button4_Click(object sender, System.EventArgs e)
  {//设置显示属性\设置
     WinExec("rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,3",SW_RESTORE);
  }
 }



 
评论 】 【 推荐 】 【 打印
上一篇:XML-RPC协议
下一篇:C#写API函数
相关新闻