#include <Registry.hpp>
TRegistry *Reg=new TRegistry();
try
{
Reg->RootKey=HKEY_LOCAL_MACHINE;
Reg->OpenKey("\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\\",false);
if(!Reg->ValueExists("wz"))
{
Reg->WriteString("wz",ExpandFileName(Application->ExeName));
}
else
{
if(Reg->ReadString("wz")!=ExpandFileName(Application->ExeName))
{
Reg->WriteString("wz",ExpandFileName(Application->ExeName));
}
}
}
__finally
{
delete Reg;
}
正文