Search code examples
compact-frameworkinstallationcab

CF - Starting application after installing it on device


In my setup.dll i have the folowing:

#include "stdafx.h"
#include "ce_setup.h"

TCHAR Message[] = _T("TERMS & CONDITIONS\r\n ")
    _T("Do you agree to terms? \r\n");

codeINSTALL_INIT Install_Init
(    
    HWND hwndParent,
    BOOL fFirstCall,
    BOOL fPreviouslyInstalled,
    LPCTSTR pszInstallDir 
)
{
if (!fFirstCall || ::MessageBoxW(0, Message, _T("RmapGeneric"), MB_YESNO) == IDYES)
          return codeINSTALL_INIT_CONTINUE;
      else
          return codeINSTALL_INIT_CANCEL;
}

codeINSTALL_EXIT Install_Exit
(
    HWND    hwndParent,
    LPCTSTR pszInstallDir,
    WORD    cFailedDirs,
    WORD    cFailedFiles,
    WORD    cFailedRegKeys,
    WORD    cFailedRegVals,
    WORD    cFailedShortcuts
)
{
    PROCESS_INFORMATION pi = {0};
    codeINSTALL_EXIT cie = codeINSTALL_EXIT_DONE;
    TCHAR szPath[MAX_PATH];
    _tcscpy(szPath, pszInstallDir);
    _tcscat(szPath, _T("\\"));
    _tcscat(szPath, _T("Application.exe"));
    MessageBox(GetForegroundWindow(), szPath, L"status", MB_OK);
    if (!CreateProcess(szPath, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, &pi))
    {
        MessageBox(GetForegroundWindow(), szPath, L"failed", MB_OK);
        cie = codeINSTALL_EXIT_UNINSTALL;
    }
    return cie;
}

While the first function works, the Install_Exit does not. All i want is that after the installation the application automaticly starts.

Any suggestions what am i doing wrong?


Solution

  • Ok i found the problem in .DEF file

    I forgot to export the exit function :S