Return to Snippet

Revision: 17456
at September 5, 2009 12:19 by richardw


Initial Code
AnsiString GetRegistryValue(AnsiString KeyName, AnsiString ValueName)
{
    AnsiString S;
    TRegistry *Registry = new TRegistry(KEY_READ);
    try
    {
        Registry->RootKey = HKEY_LOCAL_MACHINE;
        if (Registry->OpenKey(KeyName, true))
        S = Registry->ReadString(ValueName);
        Registry->CloseKey();
    }
    __finally
    {
        delete Registry;
    }
    return S;
}
//---------------------------------------------------------------------------

Initial URL

                                

Initial Description

                                

Initial Title
在注册表中存取数据

Initial Tags

                                

Initial Language
C++