CRegKey rk;
LPCTSTR lpRun = _T("Software\\Microsoft\\Windows\\CurrentVersion\\Run");REGSAM samDesired_;
samDesired_ = KEY_SET_VALUE;//32bit ,64bit need KEY_WOW64_64KEY
if (ERROR_SUCCESS == rk.Open(HKEY_LOCAL_MACHINE, lpRun, samDesired_))
{
rk.SetStringValue(_T("xxxx"),_T("c:\xxx.exe"));
}
rk.Close();