我用VC往注册表里LOCALMOCHINE /Software/下面写了自己程序的信息,只要不重启,注册表里的信息就看得见,也能用,只要一重起系统就不见了?为什么啊?

解决方案 »

  1.   

    用RegFlushKey试试。推荐使用MFC的CRegKey类。
      

  2.   

    RegCreateKeyEx中的参数设置问题
    REG_OPTION_NON_VOLATILE This key is not volatile; this is the default. The information is stored in a file and is preserved when the system is restarted. The RegSaveKey function saves keys that are not volatile.
      

  3.   

    RegSaveKeyThe RegSaveKey function saves the specified key and all of its subkeys and values to a new file.
      

  4.   

    if (RegCreateKeyEx(HKEY_LOCAL_MACHINE, szBuf, 
              0, NULL, REG_OPTION_NON_VOLATILE,
              KEY_WRITE, NULL, &hk, &dwDisp)) 
       {
          printf("Could not create the registry key."); 
          return FALSE;
       }