少妇AV一区二区三区无|久久AV电影一区三|日本一级片黄色毛片|亚洲久久成人av在线久操|黄色视频在线免费看呀一区二区|综合精品视频精品久久久浪朝|亚洲午夜成人资源|欧美黄色一级片黑寡妇|内射无毛少妇特写|无码农村夜晚偷拍啪啪

關(guān)于C++builder編程修改注冊(cè)表的問題

時(shí)間:2008-10-05 03:37:00   來源:無憂考網(wǎng)     [字體: ]
RootKey是注冊(cè)表的根鍵值,比如運(yùn)行regedit后看到的HKEY_USERS,HKEY_LOCAL_MACHINE就是RootKey,在TRegIniFile中缺省的RootKey是HKEY_USERS.

  下面的例子是TRegistry的,TRegIniFile也差不多

void __fastcall TfrmMainForm::WriteToMyRegistry(int table_count)
{
  //TODO: Add your source code here
  TRegistry *MyRegistry=new TRegistry;
  MyRegistry->RootKey=HKEY_LOCAL_MACHINE;  //改變?nèi)笔ootkey
if(!MyRegistry->OpenKey("Software\\Microsoft\\Windows\\Current\Version\\Run",true)) //打開主鍵
   //這樣雙引號(hào)里面的東西就變成了CurrentKey
   {
     Application->MessageBox("注冊(cè)表內(nèi)容無效", "讀取注冊(cè)表出錯(cuò)",MB_ICONERROR);
     MyRegistry->CloseKey();
     delete MyRegistry;
     return;
    }
  MyRegistry->WriteString("myrun","c:\\sthvcd\\sthvcd.exe");
  MyRegistry->CloseKey();
  delete MyRegistry;