小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

c#調(diào)用系統(tǒng)資源

 秋水風(fēng)帆 2010-12-30
c#調(diào)用系統(tǒng)資源
(一)
易語(yǔ)言的代碼簡(jiǎn)單高效,其原理無(wú)非就是把一些常用的命令封裝成類(lèi),并且以中文命名,在需要的時(shí)候直接調(diào)用靜態(tài)方法就是
首先:編寫(xiě)一個(gè)調(diào)用系統(tǒng)資源的大類(lèi),代碼如下
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.IO;
namespace DOS工具箱
{
    public class 調(diào)用系統(tǒng)資源
    {
        //引入API函數(shù)
        [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參數(shù)表示隱藏窗口
        private const int SW_SHOW=5;//API參數(shù)表示用當(dāng)前的大小和位置顯示窗口
       
        public static void 彈出光驅(qū)()
        {
            mciSendString("set CDAudio door open", null, 127, 0);
        }
        public static void 關(guān)閉光驅(qū)()
        {
            mciSendString("set CDAudio door closed", null, 127, 0);
        }
        public static void 打開(kāi)C盤(pán)()
        {
            Process.Start("c:\\");
        }
        public static void 打開(kāi)D盤(pán)()
        {
            Process.Start("d:\\");
        }
        public static void 打開(kāi)E盤(pán)()
        {
            Process.Start("e:\\");
        }
        public static void 打開(kāi)F盤(pán)()
        {
            Process.Start("f:\\");
        }
        public static void 打開(kāi)指定盤(pán)(string hardpath)
        {
            Process.Start(hardpath);
        }
        public static void 打開(kāi)Word()
        {
            Process.Start(@"C:\Program Files\Microsoft Office\OFFICE11\winword.exe");
        }
        public static void 打開(kāi)Excel()
        {
            Process.Start(@"C:\Program Files\Microsoft Office\OFFICE11\excel.exe");
        }
        public static void 打開(kāi)Access()
        {
            Process.Start(@"C:\Program Files\Microsoft Office\OFFICE11\msaccess.exe");
        }
        public static void 打開(kāi)PowerPoint()
        {
            Process.Start(@"C:\Program Files\Microsoft Office\OFFICE11\powerpnt.exe");
        }
        public static void 打開(kāi)OutLook()
        {
            Process.Start(@"C:\Program Files\Microsoft Office\OFFICE11\outlook.exe");
        }
        public static void 打開(kāi)記事本()
        {
            Process.Start("notepad.exe");
        }
        public static void 打開(kāi)計(jì)算器()
        {
            Process.Start("calc.exe");
        }
        public static void 打開(kāi)DOS命令窗口()
        {
            Process.Start("cmd.exe");
        }
        public static void 打開(kāi)注冊(cè)表()
        {
            Process.Start("regedit.exe");
        }
        public static void 打開(kāi)畫(huà)圖板()
        {
            Process.Start("mspaint.exe");
        }
        public static void 打開(kāi)寫(xiě)字板()
        {
            Process.Start("write.exe");
        }
        public static void 打開(kāi)播放器()
        {
            Process.Start("mplayer2.exe");
        }
        public static void 打開(kāi)資源管理器()
        {
            Process.Start("explorer.exe");
        }
        public static void 打開(kāi)任務(wù)管理器()
        {
            Process.Start("taskmgr.exe");
        }
        public static void 打開(kāi)事件查看器()
        {
            Process.Start("eventvwr.exe");
        }
        public static void 打開(kāi)系統(tǒng)
 1 2
 
信息()
        {
            Process.Start("winmsd.exe");
        }
        public static void 打開(kāi)備份還原()
        {
            Process.Start("ntbackup.exe");
        }
        public static void 打開(kāi)Windows版本()
        {
            Process.Start("winver.exe");
        }
        public static void 打開(kāi)控制面板()
        {
            Process.Start("rundll32.exe", "shell32.dll,Control_RunDLL");
        }
        public static void 打開(kāi)控制面板輔助選項(xiàng)鍵盤(pán)()
        {
            Process.Start("rundll32.exe", "shell32.dll,Control_RunDLL access.cpl,,1");
        }
        public static void 打開(kāi)控制面板輔助選項(xiàng)聲音()
        {
            Process.Start("rundll32.exe", "shell32.dll,Control_RunDLL access.cpl,,2");
        }
        public static void 打開(kāi)控制面板輔助選項(xiàng)顯示()
        {
            Process.Start("rundll32.exe", "shell32.dll,Control_RunDLL access.cpl,,3");
        }
        public static void 打開(kāi)控制面板輔助選項(xiàng)鼠標(biāo)()
        {
            Process.Start("rundll32.exe", "shell32.dll,Control_RunDLL access.cpl,,4");
        }
        public static void 打開(kāi)控制面板輔助選項(xiàng)常規(guī)()
        {
            Process.Start("rundll32.exe", "shell32.dll,Control_RunDLL access.cpl,,5");
        }
        public static void 打開(kāi)控制面板添加新硬件向?qū)?)
        {
            Process.Start("rundll32.exe", "shell32.dll,Control_RunDLL sysdm.cpl @1");
        }
        public static void 打開(kāi)控制面板添加新打印機(jī)向?qū)?)
        {
            Process.Start("rundll32.exe", "shell32.dll,SHHelpShortcuts_RunDLL AddPrinter");
        }
        public static void 打開(kāi)控制面板添加刪除程序安裝卸載面板()
        {
            Process.Start("rundll32.exe", "shell32.dll,shell32.dll,Control_RunDLL appwiz.cpl,,1");
        }
        public static void 打開(kāi)控制面板添加刪除程序安裝Windows面板()
        {
            Process.Start("rundll32.exe", "shell32.dll,shell32.dll,Control_RunDLL appwiz.cpl,,2");
        }
        public static void 打開(kāi)控制面板添加刪除程序啟動(dòng)盤(pán)面板()
        {
            Process.Start("rundll32.exe", "shell32.dll,shell32.dll,Control_RunDLL appwiz.cpl,,3");
        }
        public static void 打開(kāi)建立快捷方式對(duì)話(huà)框()
        {
            Process.Start("rundll32.exe"," appwiz.cpl,NewLinkHere %1");
        }
        public static void 打開(kāi)日期時(shí)間選項(xiàng)()
        {
            Process.Start("rundll32.exe"," shell32.dll,Control_RunDLL timedate.cpl,,0");
        }
        public static void 打開(kāi)時(shí)區(qū)選項(xiàng)()
        {
            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 打開(kāi)復(fù)制軟碟窗口()
        {
            Process.Start("rundll32.exe"," diskcopy.dll,DiskCopyRunDll");
        }
        public static void 打開(kāi)新建撥號(hào)連接()
        {
            Process.Start("rundll32.exe"," rnaui.dll,RnaWizard");
        }
        public static void 打開(kāi)顯示屬性背景()
        {
            Process.Start("rundll32.exe"," shell32.dll,Control_RunDLL desk.cpl,,0");
        }
        public static void 打開(kāi)顯示屬性屏幕保護(hù)()
        {
            Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL desk.cpl,,1");
        }
        public static void 打開(kāi)顯示屬性外觀()
        {
            Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL desk.cpl,,2");
        }
        public static void 打開(kāi)顯示屬性屬性()
        {
            Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL desk.cpl,,3");
        }
        //public static void 打開(kāi)Windows字體檔案夾()
        //{
        //    Process.Start("rundll32.exe"," shell32.dll,SHHelpShortcuts_RunDLL FontsFolder");
        //}
文章出處:飛諾網(wǎng)(www.):http://dev./course/3_program/cshapo/csharpjs/20100108/188346_2.html

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶(hù)發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買(mǎi)等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶(hù) 評(píng)論公約

    類(lèi)似文章 更多