HKEY sub; char key[200]; GetModuleFileName(NULL,key,200); CString str; str.Format("%s",key); CString mykey = "Software//Microsoft//Windows//CurrentVersion//Run"; RegCreateKey(HKEY_LOCAL_MACHINE,mykey,&sub); if(m_chset.GetCheck()) { ::RegSetValueEx(sub,"StartRun",NULL,REG_SZ,(const BYTE*)str.GetBuffer(0),str.GetLength()); } else { ::RegDeleteValue(sub,"StartRun"); }