I agree that it is cryptic, so getting started is a pain. Making
changes can also be a pain. But now that I have a setup working, it is
reliable. And it does a lot of nitty book keeping for me. In
particular, it automatically chooses the appropriate CAB file for the
target, by looking at the target's registry and by reading the CAB
files I create.
If you want to build a replacement, you can use RAPI (CeCreateFile and
relatives) to write a desktop app that can choose the appropriate CAB
file, and/or make sure the target matches one of the CAB files, then
copy the file to the target, and then "run" it. The matching target
and CAB file will be a bit tedious. The rest shouldn't be.
For various reasons, I decided to bypass CeAppMgr this week. So I'm
ready to share at least some of the "secrets". I'm still using CAB
files, but the following steps could be adapted to avoid them, too.
Step 1:
Use RAPI to determine whether a device _is_ connected. The code I use
for this is too heavily buried in private classes for me to share. I'm
pretty sure the most important piece is calling CeRapiInitEx and
checking the return code. NOTE: CeRapiInitEx and CeRapiInit are very
similar but CeRapiInitEx always returns immediately, and is thus the
right one to use for this purpose.
Step 2:
Look in the registry on the _desktop_ to determine the platform of the
attached device. See a 7 Feb 05 contribution by Peter Foot to thread
called "How can I tell which OS Platform a CE device is using?" in
microsoft.public.pocketpc.developer.
Step 3:
Look in the registry on the _desktop_ to determine the CPU in the
attached device. I found an appropriate setting (variable?) called
"DeviceProcessorType" right next to the setting for platform. Get it
as a DWORD, and compare to values in winnt.h (yes, a header that ships
with Visual Studio!!). Look for PROCESSOR_STRONGARM and relatives.
Step 4:
Use the information you've gathered to choose the appropriate CAB
file, and then copy that file to the attached device. I copy a buffer
at a time using:
a) CreateFile to open the input file on the desktop
b) CeCreateFile to open the output file on the handheld.
c) ReadFile to read a buffer from the input file
d) WriteFile to write the buffer to the output file
I repeat c and d until the file is done. Nothing deep here. Just some
careful bookkeeping. Sorry, but I can't share this code, either.
Step 5:
Use CeCreateProcess to "run" the CAB file. See a 17 Oct 02
contribution by Alexander Shargin to thread called "installing
..CAB-files" in microsoft.public.win32.programmer.wince and
microsoft.public.windowsce.embedded.vc. Note that the string arguments
passed to this function must be UNICODE (WCHAR).
For some alternatives, try using google to search for
install
in one of these newsgroups. You might also try searching for
setup
And look at:
http://www.pocketpcdn.com/sections/installation.html
-----------------------------------------
To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).
Robert E. Zaret, eMVP
PenFact, Inc.
500 Harrison Ave., Suite 3R
Boston, MA 02118
www.penfact.com
-----------------------------------------
To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).
Robert E. Zaret, eMVP
PenFact, Inc.
500 Harrison Ave., Suite 3R
Boston, MA 02118
www.penfact.com