if (bAutoStart)
{
#ifdef __WXMSW__
wxRegKey *pRegKey = new wxRegKey(
wxT("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run")
);
// will create the Key if it does not exist
if( !pRegKey->Exists() )
pRegKey->Create();
// GetExecutablePath() is a user defined function, that returns this executable path.
pRegKey->SetValue(wxApp::GetAppName(), wxStandardPaths().GetExecutablePath());
delete pRegKey;
#endif
}
else
{
#ifdef __WXMSW__
wxRegKey *pRegKey = new wxRegKey(
wxT("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run")
);
// will create the Key if it does not exist
if( pRegKey->Exists() && pRegKey->HasValue(wxApp::GetAppName()) )
pRegKey->DeleteValue(wxApp::GetAppName());
delete pRegKey;
#endif
}
{
#ifdef __WXMSW__
wxRegKey *pRegKey = new wxRegKey(
wxT("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run")
);
// will create the Key if it does not exist
if( !pRegKey->Exists() )
pRegKey->Create();
// GetExecutablePath() is a user defined function, that returns this executable path.
pRegKey->SetValue(wxApp::GetAppName(), wxStandardPaths().GetExecutablePath());
delete pRegKey;
#endif
}
else
{
#ifdef __WXMSW__
wxRegKey *pRegKey = new wxRegKey(
wxT("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run")
);
// will create the Key if it does not exist
if( pRegKey->Exists() && pRegKey->HasValue(wxApp::GetAppName()) )
pRegKey->DeleteValue(wxApp::GetAppName());
delete pRegKey;
#endif
}