Patch level :4.0 setup

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :modalita' di esecuzione server


git-svn-id: svn://10.65.10.50/trunk@15552 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luca 2007-08-08 15:24:46 +00:00
parent cb12dee318
commit cb218a6110

View File

@ -154,57 +154,6 @@ bool WriteRootRegistryKey(const wxChar* strKey, const wxString& strValue)
return ok;
}
bool CreateIcon(unsigned int csidl, const wxFileName& strExeFile)
{
//csidl = CSIDL_COMMON_DESKTOPDIRECTORY = desktop
//csidl = CSIDL_COMMON_STARTUP = all users esecuzione automatica
TCHAR szDesktopPath[MAX_PATH] = wxT("");
HRESULT hres = ::SHGetFolderPath(NULL, csidl, NULL, SHGFP_TYPE_CURRENT, szDesktopPath);
if (szDesktopPath[0] != '\0')
{
CoInitialize(NULL);
// Get a pointer to the IShellLink interface.
IShellLink* psl;
hres = CoCreateInstance(CLSID_ShellLink, NULL,
CLSCTX_INPROC_SERVER, IID_IShellLink, (void**)&psl);
if (SUCCEEDED(hres))
{
IPersistFile* ppf;
// Set the path to the shortcut target and add the description.
psl->SetPath(strExeFile.GetFullPath());
psl->SetWorkingDirectory(strExeFile.GetPath());
psl->SetDescription(APPNAME);
// Query IShellLink for the IPersistFile interface for saving the
// shortcut in persistent storage.
hres = psl->QueryInterface(IID_IPersistFile, (void**)&ppf);
if (SUCCEEDED(hres))
{
wxFileName strLnk(szDesktopPath, wxT("Campo.lnk"));
// Save the link by calling IPersistFile::Save.
wxString stringa = strLnk.GetFullPath();
wchar_t buff[_MAX_PATH];
memset(buff, 0, sizeof(buff));
wxConvLocal.MB2WC(buff, stringa, stringa.Len());
hres = ppf->Save(buff, true);
ppf->Release();
}
psl->Release();
}
CoUninitialize();
}
return true;
}
bool CreateAutostartMode(const int iSrvAutostartMode)
{
return true;
}
void AssociateExtension(const wxFileName& strExeFile, const wxChar* strExt)
{
@ -699,13 +648,13 @@ END_EVENT_TABLE()
void CampoWizardPage4::OnHLPick(wxCommandEvent& e)
{
wxString path("./chiavi/hardlock/hldrv32.exe");
wxString path("../chiavi/hardlock/hldrv32.exe");
wxExecute(path, wxEXEC_SYNC);
}
void CampoWizardPage4::OnEUPick(wxCommandEvent& e)
{
wxString path("./chiavi/eutron/sdi.exe");
wxString path("../chiavi/eutron/sdi.exe");
wxExecute(path, wxEXEC_SYNC);
}
///////////////////////////////
@ -1983,6 +1932,8 @@ class CampoSetup : public wxApp
protected:
DECLARE_EVENT_TABLE()
void OnTimer(wxTimerEvent& e);
bool CreateIcon(unsigned int csidl, const wxFileName& strExeFile) const;
bool CreateAutostartMode(const int iSrvAutostartMode, const wxString& strPath);
public:
virtual bool OnInit();
@ -1994,6 +1945,75 @@ BEGIN_EVENT_TABLE(CampoSetup, wxApp)
EVT_TIMER(883, OnTimer)
END_EVENT_TABLE()
bool CampoSetup::CreateAutostartMode(const int iSrvAutostartMode, const wxString& strPath)
{
switch (iSrvAutostartMode)
{
//link nella cartella esecuzione automatica
case 1:
{
const wxFileName strExe(strPath, wxT("/servers/lerch.exe"));
CreateIcon(CSIDL_COMMON_STARTUP, strPath);
}
break;
//esecuzione server come servizi (magia!)
default:
const wxString strCreateService = "./setup/instsrv.exe lerch ./setup/srvany.exe";
break;
}
return true;
}
bool CampoSetup::CreateIcon(unsigned int csidl, const wxFileName& strExeFile) const
{
//csidl = CSIDL_COMMON_DESKTOPDIRECTORY = desktop
//csidl = CSIDL_COMMON_STARTUP = all users esecuzione automatica
TCHAR szDesktopPath[MAX_PATH] = wxT("");
HRESULT hres = ::SHGetFolderPath(NULL, csidl, NULL, SHGFP_TYPE_CURRENT, szDesktopPath);
if (szDesktopPath[0] != '\0')
{
CoInitialize(NULL);
// Get a pointer to the IShellLink interface.
IShellLink* psl;
hres = CoCreateInstance(CLSID_ShellLink, NULL,
CLSCTX_INPROC_SERVER, IID_IShellLink, (void**)&psl);
if (SUCCEEDED(hres))
{
IPersistFile* ppf;
// Set the path to the shortcut target and add the description.
psl->SetPath(strExeFile.GetFullPath());
psl->SetWorkingDirectory(strExeFile.GetPath());
psl->SetDescription(APPNAME);
// Query IShellLink for the IPersistFile interface for saving the
// shortcut in persistent storage.
hres = psl->QueryInterface(IID_IPersistFile, (void**)&ppf);
if (SUCCEEDED(hres))
{
wxFileName strLnk(szDesktopPath, wxT("Campo.lnk"));
// Save the link by calling IPersistFile::Save.
wxString stringa = strLnk.GetFullPath();
wchar_t buff[_MAX_PATH];
memset(buff, 0, sizeof(buff));
wxConvLocal.MB2WC(buff, stringa, stringa.Len());
hres = ppf->Save(buff, true);
ppf->Release();
}
psl->Release();
}
CoUninitialize();
}
return true;
}
void CampoSetup::OnTimer(wxTimerEvent& WXUNUSED(e))
{
CampoWizard* pWizard = new CampoWizard(m_pMainFrame);
@ -2018,7 +2038,7 @@ void CampoSetup::OnTimer(wxTimerEvent& WXUNUSED(e))
if (bInstallLerch)
{
const int iSrvAutostartMode = pWizard->GetSrvAutostartMode();
CreateAutostartMode(iSrvAutostartMode);
CreateAutostartMode(iSrvAutostartMode, strDest);
}
}