準備
(なし)
デザイン
1. フォーム (Form1) にボタン (button1) を配置します。
サンプルコード (C#)
namespace WinFormsApp1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
var ps = new Process();
ps.StartInfo.FileName = "rundll32.exe";
// コントロールパネル
ps.StartInfo.Arguments = "shell32.dll,Control_RunDLL";
ps.Start();
// ゲームコントローラー
ps.StartInfo.Arguments = "shell32.dll,Control_RunDLL joy.cpl";
ps.Start();
// プログラムと機能
ps.StartInfo.Arguments = "shell32.dll,Control_RunDLL appwiz.cpl";
ps.Start();
// 画面の解像度
ps.StartInfo.Arguments = "shell32.dll,Control_RunDLL desk.cpl";
ps.Start();
// インターネットのプロパティ
ps.StartInfo.Arguments = "shell32.dll,Control_RunDLL inetcpl.cpl";
ps.Start();
// 地域と言語
ps.StartInfo.Arguments = "shell32.dll,Control_RunDLL intl.cpl";
ps.Start();
// マウスのプロパティ
ps.StartInfo.Arguments = "shell32.dll,Control_RunDLL main.cpl @0";
ps.Start();
// キーボードのプロパティ
ps.StartInfo.Arguments = "shell32.dll,Control_RunDLL main.cpl @1";
ps.Start();
// サウンド
ps.StartInfo.Arguments = "shell32.dll,Control_RunDLL mmsys.cpl";
ps.Start();
// 電話とモデム
ps.StartInfo.Arguments = "shell32.dll,Control_RunDLL modem.cpl";
ps.Start();
// システムのプロパティ
ps.StartInfo.Arguments = "shell32.dll,Control_RunDLL sysdm.cpl";
ps.Start();
// 日付と時刻
ps.StartInfo.Arguments = "shell32.dll,Control_RunDLL timedate.cpl";
ps.Start();
}
}
}
解説
rundll32.exe を使って、コントロールパネル内のアプリケーションを起動します。
結果
動作確認環境
Visual Studio 2022 Professional (.NET 7 C#11)
ログ
初版:2016.06.07 Visual Studio 2015 Professional (C# 6.0)
