CRegKey reg;??
???
? if(reg.Open(HKEY_LOCAL_MACHINE,"System\\CurrentControlSet\\Control\\Session Manager\\Environment\\")==ERROR_SUCCESS)?? //?? 路徑自定??
? {??
??????? TCHAR???? path[MAX_PATH];??
??????? DWORD???? dw = MAX_PATH;
??????? if(ERROR_SUCCESS==reg.QueryValue(path,"path",&dw))??
??????? {???
???????????????MessageBox(path,"找到Path了");???
???????????????CString AltPath = path;?
???????????????CString str;
???????????????//長度
???????????????str.Format("%d",AltPath.GetLength());
???????????????MessageBox(str);
???????????????//顯示字符的位置
???????????????str.Format("%d",AltPath.Find("需要的字符串;",1));
???????????????MessageBox(str);
???????????????//刪除原來的字符串
???????????????AltPath.Delete(AltPath.Find("字符串;",1),13);
???????????????MessageBox(AltPath);
???????????????//添加新路徑
???????????????AltPath.Insert(AltPath.GetLength(),"添加的新字符串;");
???????????????reg.SetValue(HKEY_LOCAL_MACHINE,"System\\CurrentControlSet\\Control\\Session???? Manager\\Environment\\path",AltPath,"");
???????????????reg.SetValue(AltPath,"path");
???????????????reg.QueryValue(path,"path",&dw);
???????????????MessageBox(path);
???????????????reg.Close();
?????????? }??
?
? }?
? else
? {
??MessageBox("lalal");
??? ?//注冊表鍵值不存在??
??MessageBox("Path?? Not?? Found!");
? }?
只有注冊用戶登錄后才能發表評論。 | ||
【推薦】100%開源!大型工業跨平臺軟件C++源碼提供,建模,組態!
![]() |
||
網站導航:
博客園
IT新聞
BlogJava
博問
Chat2DB
管理
|
||
|
| |||||||||
日 | 一 | 二 | 三 | 四 | 五 | 六 | |||
---|---|---|---|---|---|---|---|---|---|
27 | 28 | 29 | 30 | 31 | 1 | 2 | |||
3 | 4 | 5 | 6 | 7 | 8 | 9 | |||
10 | 11 | 12 | 13 | 14 | 15 | 16 | |||
17 | 18 | 19 | 20 | 21 | 22 | 23 | |||
24 | 25 | 26 | 27 | 28 | 29 | 30 | |||
1 | 2 | 3 | 4 | 5 | 6 | 7 |
Welcome!
常用鏈接
留言簿(1)
隨筆檔案
相冊
收藏夾
搜索
最新評論

- 1.?re: 學習VC中讀寫ini文件(轉)
- 大致的意思倒是很容易 至于WinAPI函數嘛 對于我這個編程超級新手而言 就還暫時沒有學習了 呵呵呵呵
- --江水獸
- 2.?re: 實習感悟
- 寫的還不錯,恩,態度還是比較認真的,就是文筆差點,還是要多多學習,不斷進步,我永遠支持您,加油!
- --songofwind
- 3.?re: 新手上路,大家多多包涵
-
這么巧啊!呵呵!我打cs也是業余,打混戰還可以.比賽就是菜了.
你好!我對安全比較感興趣,密碼是很重要的一個環節,以后不懂的就問你!
- --saga.constantine
- 4.?re: 新手上路,大家多多包涵
- 評論內容較長,點擊標題查看
- --小歪
- 5.?re: 新手上路,大家多多包涵
- 歡迎!!我對密碼也比較感興趣,就是還沒怎么研究.以后共同學習!
- --saga.constantine