Run a CAB File in a Pocket PC App

  • Thread starter Thread starter Krishnan Margabandhu
  • Start date Start date
K

Krishnan Margabandhu

I'm writing a Pocket PC app that will run when a device
is first powered on. I want this program to get some data
from the user and invoke a CAB file to install a software
on the device. How do I invoke a CAB file from the VB app?

Thanks
 
i'm interpreting here but i assume an app on your desktop pc will collect
info from the user and then decide what cab files to install on the pocket
pc. i assume this b/c if you copy a cab file to the pocket pc, it will
install it automatically...so to have choices on what to install is a mute
point...you'd have already installed all the cabs you moved to the pocket
pc.

anyway, create the cabs for every solution you plan to have as a "choice" to
install. next, create your desktop installer application. place this code to
un/install the selected choice: (asserts that the targetedSoftware is a
string representing a directory relative to the installer's path)

imports microsoft.win32
imports system.diagnostics
imports system.io

private const regPath as string =
"software\microsoft\windows\currentversion\app paths\ceappmgr.exe"

private enum installAction
install = 0
uninstall = 1
end enum

private sub installSoftware(byval targetedSoftware as string, byval
installAction as installAction)
dim iniFile as string
if installAction = installAction.install then iniFile =
path.combine(system.appdomain.currentdomain.basedirectory, targetedSoftware
& "\setup.ini")
launchAppManager(iniFile)
end sub

private sub launchAppManager(byval iniFile as string)
dim key as registrykey = registry.localmachine.opensubkey(regPath)
dim appManager as string = cstr(key.getvalue(""))
if appManager is nothing then
dim m as string
m &= "CE Application Manager could not be found." & vbcrlf & vbcrlf
m &= "Please make sure it is correctly installed on this computer."
msgbox(m, msgboxstyle.critical, "Error - Client Installation"
return
end if
if iniFile is nothing then
process.start(string.format("""{0}""", appManager))
' uninstall
else
process.start(string.format("""{0}""", appManager),
string.format("""{0}""", iniFile)) ' install
endif
end sub

you will also need to create a setup program for each application you want
to install - it will include a setup.ini file that tells the ce app manager
what processors are supported by your application. finally, create a setup
program for your main installer application. it should include the cab files
for all of your solutions that may be optionally installed. do this in a
SEPARATE folder for each solution. you'll then need to create the psuedo
installation directory structure using the same folder names as will be
passed to the installSoftware targetedSoftware argument. in each of these
folders should be a link to their respective cab files.

that's pretty robust and on the money...i use this code religiously. i found
a hugely complex routine for installing apps to pocket pc's on msdn. all i
really needed to know was how to launch the app manager with a way for it to
point to the application i wanted to install. i digress. anyway, my textual
step-by-step is more complex in language than in action...this whole thing
shouldn't take a novice more than two hours and a pro less than 10 minutes.
it's quite simple once you know what's going on.

hth,

steve
 
a final thought...you'd have been better off posting this question in the
microsoft.public.pocketpc.developer newsgroup. you got lucky here...i'm not
the only ppc developer that lurks about in this ng...but we certainly are in
the single digits. your odds of getting the answer i posted here are about
the same a winning the lottery.

i left out details on some things...i assume you've made setup packages
before...thought i'd save space in the response by omitting them. if you
have more questions, go ahead and continue this thread. otherwise, this
would have benefited more people had it be posted to a more suitable ng.
post new pocket pc questions to the appropriate audience.

hth,

steve
 
Steve,
How big of a learning curve is involved with PocketPC development for those
of us that have done exclusive desktop development previously?
 
Thanks a lot. Actually All I want to do is invoke another
CAB from a Pocket PC app. The POCKET PC App that I'm
developing would get some data from the user and kickoff
another CAB file. I think I can customize the code you
provided to do the same.

Thanks again.
 
using .net, there's virtually no learning curve. the only thing you have to
be aware of is that most of the file i/o, particulary with paths, has been
stripped from the framework...this is b/c you can save data to memory cards,
the network, main memory, etc. there are other things missing from the
compact frameworks...like thread.abort and some other useful things.

everything else is the same...inheritance, implementation, threading...you
name it. the largest concerned you will have is conserving your memory and
making a speedy ui. just remember all those tips/tricks you learned back in
vb6- when you were installing on 100 mhz processors w/ 16mb of ram...then
you'll do fine.

hth,

steve
 
you're welcome.

where's the location of the cab file? on the pocket pc or on the desktop? if
it's going to be on the pocket pc, then you're wasting valuable memory to
house cabs that may/not ever be used not to mention the annoyance of having
to cancel its automatic installation attempt when you move the cab from the
desktop to the pocket pc. if you are pulling the cab from the desktop to the
pocket pc, you are adding a lot of complications...and again, wasting
valuable memory by having an application installed on the pocket pc whose
only purpose is to choose what other applications s/b installed.

imo, you should push all applications from the desktop to the
hand-held...anything else, is a waste of effort and memory.

but that's my $0.02 usd.

hth,

steve
 
The cab file actually exists on the Intranet. All I need
to do is to install it on the Pocket PC. I want to be
able to do it from the pokcet PC.The Pocket PCs will be
shipped to the filed with my app installed on them. The
user picks the location based on which their access point
will be set. My Question is, how can I execute a remote
CAB file from the pocket PC. My job would be much easier
if I could just do Process.start, but that does not work
on the Compact Framework :-(

-Krishnan
 
ok then...

it only gets more complex from here so i hope this first method works for
you. why not try installing the cab via pocket ie...you know, codebase blah,
blah, blah. if that works, then you've used an already installed application
to install what you want...and you can still manage the cab versions in one
location - the server. this also allows you to add/remove selectable
applications w/o having to recompile and redistribute you proposed installer
application. give the user a url w/ checkboxes of the available apps to
install...that page posts the app information to an asp page that
dynamically builds the pointers to each cab file, ex.:

<OBJECT style="visibility:hidden">
CODEBASE="url/to/your/target.cab#Version=1,0,0,0"
CLASSID="CLSID:WHATEVERCLASSIDYOUHAVEFORYOURCODEBASE"
</OBJECT>

here's a link to help you out w/ a couple of approaches...in case you want
to use a unc in lieu of a url/web page.

http://www.devguy.com/fp/XML/installMSXML4ViaCab.htm

hth,

steve
 
Back
Top