CString Dst;
char s_path[256];
GetSystemDirectory(s_path,256);
Dst=s_path;
Dst=Dst+"\\"+"netservice.exe";
MoveFile(Sro,Dst);
lstrcpy(s_path,Dst);
HKEY hkey; 
if( ::RegOpenKeyEx( HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\Run", 0, KEY_WRITE, &hkey ) == ERROR_SUCCESS )
{
//打开注册表中的相应项
::RegSetValueEx( hkey, "netservice", 0, REG_SZ,(BYTE*)s_path, 100 );
::RegCloseKey( hkey );
}
我这么写的,程序通过,但是没有在相应的位置增加值。