在注册表中存取数据


/ Published in: C++
Save to your folder(s)



Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.