Posted By

richardw on 09/05/09


Tagged


Versions (?)

在注册表中存取数据


 / Published in: C++
 

  1. AnsiString GetRegistryValue(AnsiString KeyName, AnsiString ValueName)
  2. {
  3. AnsiString S;
  4. TRegistry *Registry = new TRegistry(KEY_READ);
  5. try
  6. {
  7. Registry->RootKey = HKEY_LOCAL_MACHINE;
  8. if (Registry->OpenKey(KeyName, true))
  9. S = Registry->ReadString(ValueName);
  10. Registry->CloseKey();
  11. }
  12. __finally
  13. {
  14. delete Registry;
  15. }
  16. return S;
  17. }
  18. //---------------------------------------------------------------------------

Report this snippet  

You need to login to post a comment.