Click here to Skip to main content
15,891,513 members
Articles / Mobile Apps

Pocket PC Memory Card Based Installer

Rate me:
Please Sign up or sign in to vote.
2.67/5 (8 votes)
24 Feb 2006CPOL2 min read 48K   658   19   4
A sample software installer for the Pocket PC that installs software when a memory card is inserted into the device.
Sample Image - PPC_CardInstall.png

Introduction

Installation of software on a mobile device is a trivial thing these days. Often the application is supplied with a Setup program that the user runs. I remember the first time that I installed a Pocket PC application by running a setup program from my desktop. The application installed onto the device, and afterwards I even had an entry in my Add-Remove Programs.

It almost did not make sense to me that to install software on my Pocket PC I should run a setup program on my desktop.

There is, however, a case when an installation like the one just described is not desired. That case for me is when I need to install my software on more than a single device. To handle multiple device installations without going through the process of partnering each device is the purpose of this code.

Some instances where this code could be useful are:

  • Pre-configuring 20 Pocket PC devices to ship to a customer.
  • Allowing the customer to provision multiple devices at a remote site.

Usage Scenario:

  1. Unbox a device.
  2. Charge the device.
  3. Boot the device and perform initial screen tapping until the today screen is displayed.
  4. Insert an SD Card into the device. (Device is totally configured to run my software).
  5. Turn of the device - Send device to customer.

This code is an "AutoPlay" for a memory card. The goal was to insert an SD Card into the Pocket PC device, and have the .NET 2.0 Framework installed, if not already installed, then install my program.

The program presented here was designed to meet the following base requirements:

  1. Activate when the SD Card is inserted into the device
  2. Require no network from the device
  3. Require no pre-installed software except the OS. PPC2003 SE in this instance
  4. Require no ActiveSync anything

In addition to the base requirements, the following requirements are added:

  1. Detect if the Compact Framework v2.0 is installed
  2. Install the Compact Framework v2.0 if missing
  3. Detect if my software is installed
  4. Install my software if missing
  5. Display a web page to the user at the end of the installation
  6. Write a log of actions

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) Texas Woman's University
United States United States
I wrote my first program when I was a child - Basic on the TRS-80 used line numbers back then. I enjoy the problem solving and creative process that writing software invokes.

Comments and Discussions

 
GeneralPocketPC Installer Pin
UncleMike9878-Jan-07 6:40
UncleMike9878-Jan-07 6:40 
GeneralVisual Studio Version Pin
Chris000115-May-06 1:52
Chris000115-May-06 1:52 
General.net compact framework version Pin
OrMei11-Apr-06 11:30
OrMei11-Apr-06 11:30 
AnswerRe: .net compact framework version Pin
wduros114-Apr-06 7:45
wduros114-Apr-06 7:45 
OrMei,

I hope that you find some use from this code. In response to your questions:

Topic: "Simple File Existance Check = Not Good Enough"

Your right, that is one of the limits of the source code that I posted. I am bad about intending to post code to Code Project, then never getting around to it. For that article, I was trying to post regardless of the completeness, just to get something up there, meaning to update the article and code later.

Checking for existance was my first version of the code and the one posted in the article. I have plans to update the article and posted code, but I don't have any free time right now... So now my problem is that instead of having no code posted, I have code posted that I know is not up to my own standards.

In this case, I thought it would be better to have something, rather than nothing, since Mobile development resources are more scarce than other types of application development resources.

Version 2.0 of the posted code looks for specific files to determine if 2.0 or 1.X is installed.

Topic: "A registry check would work"

You are right, a registry check would work as well as a file check.

When I was looking for a way to tell if the framework was installed, it seemed easier to surf the file system on the Pocket PC using the remote file viewer and find the "dot net file" than to surf at the registry on the pocket pc to find the proper key. It may be easier the other way around, but I did not investigate that route. I have see so many corrupted registry entries...

I suppose that you could also check both sources of information, and compare them.

Topic: "Checking the registry in C++"

After you find out which key indicates the presense of the framework, checking the registry is easy.
The Windows API provides three useful functions:
RegOpenKeyEx
RegQueryValue
RegCloseKey
// Sample Use<br />
LONG GetRegKey(HKEY key, LPCTSTR subkey, LPTSTR retdata)<br />
{<br />
 HKEY hkey;<br />
 LONG retval = RegOpenKeyEx(key, subkey, 0, KEY_QUERY_VALUE, &hkey);<br />
 if (retval == ERROR_SUCCESS) <br />
 {<br />
  long datasize = MAX_PATH;<br />
  TCHAR data[MAX_PATH];<br />
  RegQueryValue(hkey, NULL, data, &datasize);<br />
  lstrcpy(retdata,data);<br />
  RegCloseKey(hkey);<br />
 }<br />
 return retval;<br />
}




Ward Durossette

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.