C 讀取登錄檔,C 建立任務計畫

2022-07-04 22:12:10 字數 707 閱讀 3704

string tpath = "";

registrykey mykey = registry.localmachine;

registrykey subkey = mykey.opensubkey(@"software\dsccheck");

tpath = subkey.getvalue("path").tostring();

tpath = tpath + @"\" + "test.exe";

說明:其中(@"software\dsccheck")代表需要讀取的檔案在登錄檔中的路徑

下面是將test.exe檔案新增到任務計畫中,定時執行 dsctasks.dsctask ctask = new dsctasks.dsctask();

hashtable htwork = new hashtable();

dailytrigger tdaily = new dailytrigger(thour, tmintue, 1);//設定系統執行時間

tdaily.begindate = dtbegindate;//開始執行時間

tdaily.enddate = dtenddate;//結束執行時間

htwork.add(htwork.count, tdaily);//加入到任務計畫執行中

ctask.createtask("dsccheck", tpath, htwork);//建立任務計畫

C 讀取登錄檔,C 建立任務計畫

string tpath registrykey mykey registry.localmachine registrykey subkey mykey.opensubkey software dsccheck tpath subkey.getvalue path tostring tpath t...

C 登錄檔讀取函式

string cconvert getregstr string name,char base 得到name的字串值s,result必須先初始化 dword dwcount 255 regqueryvalueex hresult,name.c str 0,0,byte result 0 dwcoun...

C 讀取登錄檔資訊

登錄檔是視窗系統的乙個核心的資料庫,在這個資料庫中存放中與系統相關的各種引數,這些引數直接控制中系統的啟動 硬體的驅動程式安裝資訊以及在視窗系統 上執行的各種應用程式的註冊資訊等。這就意味著,如果登錄檔因為某些原因受到了破壞,輕者是視窗系統啟動過程出現異常,重者就有可能導致整個系統的完全癱 瘓。所以...