N B

Hey guys i have some questions.

1 How can we start an application after installation. I need to do it programatically. I have written a program that installs multiple cabs in the mobile. I just want to start the application as soon as it is installed.

2. Is it possible for any application to uninstall itself after completing its job




Re: Smart Devices General Application launching program

Ilya Tumanov

1. Either use RAPI to start it from desktop side or add setup DLL into your application CAB (native C++ only).

2. Yes. Your application can spawn removal process (specifics depend on OS version) and terminate right away so it can be removed.






Re: Smart Devices General Application launching program

N B

Ilya can you provide me any link for the same. What we want to achieve is to run application as soon as it is installed in deivce.

We have an installer program. User can download this from clicking the link. As soon as it is downloaded on device its get installed. Now we have to run the installer application.






Re: Smart Devices General Application launching program

Ilya Tumanov

What kind of the "installer program" Is that just a CAB or is it an EXE If it's an EXE, then launch your application from it after installation is done.

If you downloading a CAB file then use setup DLL. There¡¯s a sample project in WM SDKs, for example this is a location in WM 6.0 SDK:

%ProgramFiles%\Windows Mobile 6 SDK\Samples\Common\CPP\Win32\SetupDLL






Re: Smart Devices General Application launching program

N B

Hi,

Now I m using the setup.dll for installation the cab. App is installing but after installation app is not starting. I have made changes in setupdll to launch the application as soon as application installed. But application is not launching. I have pasted the code below. Whats wrong i m doing here

SETUP_API codeINSTALL_EXIT Install_Exit(

HWND hwndParent,

LPCTSTR pszInstallDir, // final install directory

WORD cFailedDirs,

WORD cFailedFiles,

WORD cFailedRegKeys,

WORD cFailedRegVals,

WORD cFailedShortcuts

)

{

PROCESS_INFORMATION pi = {0};

DWORD dwRes = 0;

codeINSTALL_EXIT cie = codeINSTALL_EXIT_UNINSTALL;

/********************************************************************************************************************************************

here i m trying to launch the aaplication

********************************************************************************************************************************************/

if (FALSE == CreateProcess(TEXT("\\Temp\\installer\\installer.exe"), NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, &pi))

{

goto Error;

}

dwRes = WaitForSingleObject(pi.hProcess, REGISTER_WAIT_TIME);

if (WAIT_OBJECT_0 != dwRes)

{

goto Error;

}

// Registered...Check result.

if (FALSE == GetExitCodeProcess(pi.hProcess, &dwRes))

{

goto Error;

}

ASSERT(STILL_ACTIVE != dwRes);

if (0 != dwRes)

{

goto Error;

}

cie = codeINSTALL_EXIT_DONE;

Error:

return cie;

}






Re: Smart Devices General Application launching program

N B

Hey can anybody has any idea about what i am doing wrong, or its not possible to launch application after completion of installation.




Re: Smart Devices General Application launching program

Ilya Tumanov

Why don't you debug it E.g. show message box at the start of the function then attach debugger, set break point and debug as usual.

As to what's wrong, are you sure you have this exe file in the TEMP folder How it got in this folder you not even supposed to use






Re: Smart Devices General Application launching program

N B

Hi Ilya,

I did try to debug it and installation is working fine i m getting messages. But problem is with the launching the application.

Ilya our installer cab is installed on \\Temp\installer folder. This installer program installs our main application and other dependent cab.






Re: Smart Devices General Application launching program

Ilya Tumanov

CAB location does not matter, only application location matters. Do you have actual EXE in this folder






Re: Smart Devices General Application launching program

N B

Ilya,

I am trying to start the application after installation is completed. We don't want to user to click on our installer to install the application.

In device installer application is installed but installer.exe does not run..






Re: Smart Devices General Application launching program

Ilya Tumanov

Yes, I got that. Your code looks fine to me, so now you need to find out why exactly it won't start the EXE. The questions you should answer are:

- Is setup DLL actually invoked (and as I can see that is the case)

- Where exactly it fails (line of code)

- What is the error code returned by GetLastError() after failure and what it means

Assuming your setup DLL is indeed invoked I would guess installer.exe is not really in \Temp\installer so it won't start because there's no file to start at that location. If this EXE is inside a CAB it probably would end up in the folder specified by pszInstallDir variable.