怎么让程序自动运行,比如,刚下载下来,开机的时候
char TempPath[MAX_PATH];
TRegistry *Registry;
GetSystemDirectory(TempPath ,MAX_PATH);
SystemPath=AnsiString(TempPath);
CopyFile(ParamStr(0).c_str(), AnsiString(SystemPath+"\\yourapp.exe").c_str() ,FALSE);
Registry=new TRegistry;
Registry->RootKey=HKEY_LOCAL_MACHINE;
Registry->OpenKey("Software\\Microsoft\\Windows\\CurrentVersion\\Run",TRUE);
try
{
if(Registry->ReadString("Win Server")!=SystemPath+"\\yourapp.exe")
Registry->WriteString("Win Server",SystemPath+"\\yourapp.exe");
}
__finally
{
delete Registry;
}