开发者

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 开发者_C百科= 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?


There's nothing completely obvious as to what's wrong. Are you certain that the target executable is in that folder? Have you called GetLastError to see why it's failing?


Ok i found the problem in .DEF file

I forgot to export the exit function :S

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜