QA: How to uninstall a Pocket PC application?

Andrey Yatsyk (andrew@softspb.com), December 26, 2001.

Question

User can uninstall an application from Pocket PC device by selecting the application title in "Settings\Remove Programs" and clicking on Remove button. Can I implement the same actions from my eVC or eVB code?

Answer

In order to remove an application from Pocket PC device you can use \Windows\unload.exe. This is a command line utility that requires two strings separated by white space. The first string is an application provider and the second one is an application name. The resulting string must be exact equal the string in "\Settings\Remove Programs" applet. To uninstall application simple execute upload.exe with described parameters in your code.

If you want to run unload.exe from eVC you can use STUtil library. This library provides simple interface for child process execution on Pocket PC. For example this code uninstalls Palbum, distributed by Spb Software House:

CString strArguments = TEXT("Spb Software House Palbum"); CSTUtil::RunExecutable(L"\\Windows\\unload.exe", strArguments);

If you avoid of using third party libraries in your code use CreateProcess() call provided by operating system for process starting:

PROCESS_INFORMATION pi; CString strArguments = TEXT("Spb Software House Palbum"); ::CreateProcess(L"\\Windows\\unload.exe", strArguments, NULL, NULL, FALSE, 0, NULL, NULL, NULL, &pi);

Related resources: