News | Articles | Libraries | Developer Tools | Books | Forum Links | Search   
Sections:
 

QA: How to install a cab file on Pocket PC?

By Victor Sharov, October 26, 2001.
Print version

Question

I need to install a cab file that is already downloaded to my Pocket PC. How can I do it from my program?

Answer

Actually the only thing you need is just to start this file. Usually it is done by creating a new process via CreateProcess() as it is described in QA: How can I start another program and wait until it will be finished?. But in this case such approach does not work. To install a cab file you should call ShellExecuteEx function defined in "Shellapi.h" file and pass it a pointer to SHELLEXECUTEINFO structure that contains and receives information about the application being executed.

Note: Pocket PC doesn't support local file names. All file names should contain full path like _T("\\temp\\my.cab").

Source code

Here is a sample code that installs "my.cab" file located in "\temp" folder:

// Specify an action for the application to perform, flags and other parameters SHELLEXECUTEINFO info; info.cbSize = sizeof(info); info.fMask = SEE_MASK_FLAG_NO_UI; info.hwnd = NULL; info.lpVerb = _T("open"); info.lpFile = _T("\\Temp\\my.cab"); info.lpParameters = _T(""); info.lpDirectory = _T(""); info.nShow = SW_SHOW; info.hInstApp = AfxGetInstanceHandle(); // Call to perform an action ShellExecuteEx(&info);

Related resources:

Discuss

Discuss this article. Here you can write your comments and read comments of other developers.
Rate this article:     Poor Excellent    
 12345 
© 2001-2005 Pocket PC Developer Network, a division of Spb Software House