시작프로그램 등록
잡다한 정보들(기타정보)
2009. 8. 3. 15:31
BOOL bRtn = TRUE;
HKEY hOpenKey;
CString sExePath = CFolderPathFinder::GetModulePath() + IBT_DAEMON_EXE;
BYTE* pByte;
pByte = (BYTE*)(LPTSTR)(LPCTSTR)sExePath;
// 혹시 run이 없다면... (그럴일은 거의 없겠지만...)
if (::RegOpenKey(HKEY_LOCAL_MACHINE, REG_RUN_PATH, &hOpenKey) != ERROR_SUCCESS)
{
// 열지 못했으면 생성
if (::RegCreateKey(HKEY_LOCAL_MACHINE, REG_RUN_PATH, &hOpenKey) == ERROR_SUCCESS)
{
if (::RegSetValueEx(hOpenKey, IBT_DAEMON_TITLE, 0, REG_SZ, pByte, sExePath.GetLength()) != ERROR_SUCCESS)
bRtn = FALSE;
}
}
else
{
if (::RegSetValueEx(hOpenKey, IBT_DAEMON_TITLE, 0, REG_SZ, pByte, sExePath.GetLength()) != ERROR_SUCCESS)
bRtn = FALSE;
}
::RegCloseKey(hOpenKey);