//引入API函數
[DllImportAttribute("user32.dll")]
public static extern int FindWindow(string ClassName,string WindowName);
[DllImport("user32.dll")]
public static extern int ShowWindow(int handle, int cmdShow);
[DllImport("winmm.dll", EntryPoint = "mciSendString", CharSet = CharSet.Auto)]
public static extern int mciSendString(string lpstrCommand, string lpstrReturnstring, int uReturnLength, int hwndCallback);
private const int SW_HIDE=0;//API參數表示隐藏視窗
private const int SW_SHOW=5;//API參數表示用目前的大小和位置顯示視窗
public static void 彈出光驅()
{
mciSendString("set CDAudio door open", null, 127, 0);
}
public static void 關閉光驅()
mciSendString("set CDAudio door closed", null, 127, 0);
public static void 打開C槽()
Process.Start("c:\\");
public static void 打開D盤()
Process.Start("d:\\");
public static void 打開E盤()
Process.Start("e:\\");
public static void 打開F盤()
Process.Start("f:\\");
public static void 打開指定盤(string hardpath)
Process.Start(hardpath);
public static void 打開Word()
Process.Start(@"C:\Program Files\Microsoft Office\OFFICE11\winword.exe");
public static void 打開Excel()
Process.Start(@"C:\Program Files\Microsoft Office\OFFICE11\excel.exe");
public static void 打開Access()
Process.Start(@"C:\Program Files\Microsoft Office\OFFICE11\msaccess.exe");
public static void 打開PowerPoint()
Process.Start(@"C:\Program Files\Microsoft Office\OFFICE11\powerpnt.exe");
public static void 打開OutLook()
Process.Start(@"C:\Program Files\Microsoft Office\OFFICE11\outlook.exe");
public static void 打開記事本()
Process.Start("notepad.exe");
public static void 打開電腦()
Process.Start("calc.exe");
public static void 打開DOS指令視窗()
Process.Start("cmd.exe");
public static void 打開系統資料庫()
Process.Start("regedit.exe");
public static void 打開畫圖闆()
Process.Start("mspaint.exe");
public static void 打開寫字闆()
Process.Start("write.exe");
public static void 打開播放器()
Process.Start("mplayer2.exe");
public static void 打開資料總管()
Process.Start("explorer.exe");
public static void 打開任務管理器()
Process.Start("taskmgr.exe");
public static void 打開事件檢視器()
Process.Start("eventvwr.exe");
public static void 打開系統資訊()
Process.Start("winmsd.exe");
public static void 打開備份還原()
Process.Start("ntbackup.exe");
public static void 打開Windows版本()
Process.Start("winver.exe");
public static void 打開控制台()
Process.Start("rundll32.exe", "shell32.dll,Control_RunDLL");
public static void 打開控制台輔助選項鍵盤()
Process.Start("rundll32.exe", "shell32.dll,Control_RunDLL access.cpl,,1");
public static void 打開控制台輔助選項聲音()
Process.Start("rundll32.exe", "shell32.dll,Control_RunDLL access.cpl,,2");
public static void 打開控制台輔助選項顯示()
Process.Start("rundll32.exe", "shell32.dll,Control_RunDLL access.cpl,,3");
public static void 打開控制台輔助選項滑鼠()
Process.Start("rundll32.exe", "shell32.dll,Control_RunDLL access.cpl,,4");
public static void 打開控制台輔助選項正常()
Process.Start("rundll32.exe", "shell32.dll,Control_RunDLL access.cpl,,5");
public static void 打開控制台添加新硬體向導()
Process.Start("rundll32.exe", "shell32.dll,Control_RunDLL sysdm.cpl @1");
public static void 打開控制台添加新列印機向導()
Process.Start("rundll32.exe", "shell32.dll,SHHelpShortcuts_RunDLL AddPrinter");
public static void 打開控制台添加删除程式安裝解除安裝面闆()
Process.Start("rundll32.exe", "shell32.dll,shell32.dll,Control_RunDLL appwiz.cpl,,1");
public static void 打開控制台添加删除程式安裝Windows面闆()
Process.Start("rundll32.exe", "shell32.dll,shell32.dll,Control_RunDLL appwiz.cpl,,2");
public static void 打開控制台添加删除程式啟動盤面闆()
Process.Start("rundll32.exe", "shell32.dll,shell32.dll,Control_RunDLL appwiz.cpl,,3");
public static void 打開建立快捷方式對話框()
Process.Start("rundll32.exe"," appwiz.cpl,NewLinkHere %1");
public static void 打開日期時間選項()
Process.Start("rundll32.exe"," shell32.dll,Control_RunDLL timedate.cpl,,0");
public static void 打開時區選項()
Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL timedate.cpl,,1");
public static void 建立公文包()
Process.Start("rundll32.exe"," syncui.dll,Briefcase_Create");
public static void 打開複制軟碟視窗()
Process.Start("rundll32.exe"," diskcopy.dll,DiskCopyRunDll");
public static void 打開建立撥接上網()
Process.Start("rundll32.exe"," rnaui.dll,RnaWizard");
public static void 打開顯示屬性背景()
Process.Start("rundll32.exe"," shell32.dll,Control_RunDLL desk.cpl,,0");
public static void 打開顯示屬性螢幕保護()
Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL desk.cpl,,1");
public static void 打開顯示屬性外觀()
Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL desk.cpl,,2");
public static void 打開顯示屬性屬性()
Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL desk.cpl,,3");