이경문님의 허락 없이 좀 고쳐봤습니다.
그냥 심심해서.. ^^
몇가지 버전을 더한 것 뿐이고.. 헤더파일만 고쳤습니다.
새로 추가된 함수의 이름을 RegStartUp등으로 바꾼 것은 AnsiString
버전을 따로 쓰기 위함입니다.
왠지 API만으로 작성하신 것 같아서 범용성을 고려한 것인가 싶었는데
cpp파일을 보니 Appication->ExeName을 참조하는 부분이 있군요.
사실 그 부분도 #ifdef FormsHPP / #endif로 싸 줘야 될 것 같죠..
PS.. 테스트는 안해봤어요.. 에러나도 모름.. ^^
//---------------------------------------------------------------------------
#ifndef StartUpH
#define StartUpH
#include <Windows.hpp>
// Registry에 시작프로그램으로 등록한다.
// exam : ResigterStartUp("Project1", false, "c:\test\Project1.exe");
// 성공할 경우 0을 반환한다.
HRESULT RegisterStartUp(const char *pTitle, bool bRunOnce = false, const char *pCmdLine = NULL);
// 새로 추가된 버전들..
#ifdef FormsHPP // Application에 접근하려면 forms.hpp가 포함되어 있어야 함
HRESULT RegStartUp(bool lRunOnce = false)
{return RegisterStartUp(Application->Title.c_str(), lRunOnce, NULL);}
#endif // FormsHPP
#ifdef DSTRING_H // AnsiString이 정의되어 있는 경우
HRESULT RegStartUp(const String &sTitle, bool lRunOnce = false)
{return RegisterStartUp(sTitle.c_str(), lRunOnce, NULL);}
HRESULT RegStartUp(const String &sTitle, const String &sCommandLine, bool lRunOnce = false)
{return RegisterStartUp(sTitle.c_str(), lRunOnce, sCommandLine.c_str());}
#endif // DSTRING_H
// Registry에 시작프로그램으로 등록된 부분(pTitle)을 삭제한다.
// exam : ResigterStartUp("Project1", false);
// 성공할 경우 0을 반환한다.
HRESULT UnregisterStartUp(const char *pTitle, bool bRunOnce = false);
// 새로 추가된 버전들..
#ifdef FormsHPP // Application에 접근하려면 forms.hpp가 포함되어 있어야 함
HRESULT UnregStartUp(bool lRunOnce = false)
{return UnregisterStartUp(Application->Title.c_str(), lRunOnce);}
#endif // FormsHPP
#ifdef DSTRING_H // AnsiString이 정의되어 있는 경우
HRESULT UnregStartUp(const String &sTitle, bool lRunOnce = false)
{return UnregisterStartUp(sTitle.c_str(), lRunOnce);}
#endif // DSTRING_H
//---------------------------------------------------------------------------
#endif
|