Windows Phone Thoughts - Daily News, Views, Rants and Raves

Check out the hottest Windows Mobile devices at our Expansys store!

Digital Home Thoughts

Loading feed...

Laptop Thoughts

Loading feed...

Android Thoughts

Loading feed...

Go Back   Thoughts Media Forums > WINDOWS PHONE THOUGHTS > Windows Phone Software

Thread Tools Display Modes
Old 07-23-2005, 03:34 PM
5000+ Posts? I Should OWN This Site!
Join Date: Jun 2007
Posts: 5,067
Default Mad Programmer's File Dialog Changer, killer of CabInstl Ė a real must!

Ever wondered how you could install your CAB files onto your memory card/File Store, and not just in the default location in RAM? Yes, you probably already know the answer: CabInstl, which is indeed a great little program.

However, CabInstl doesnít intregrate well into the Windows Mobile operating system.

What does this mean?

Whenever CABís are automatically started, and thatís the case when ActiveSync installs or reinstalls an application, for example when you relocate them (you may want to read my tutorial on relocating apps easily, without reinstallation on the desktop, with ActiveSync), CAB files are just executed without CabInstl's getting into the game.

Much as you can tell ActiveSync in where to install your app, it will put it in the root directory there if you install it to an alternative medium. That is, you wonít be able to fine-tune it to specify a target directory (for example, \MyPrograms or a directory of any name). In these cases, a solution that integrates better than CabInstl into the operating system is certainly welcome. (Incidentally, this question is often asked on PPC forums; for example, here.)


First, install Mad Programmer's FileDialogChanger (the current version is 1.50) and gsGetFile.dll and import the following registry file ( here's a generic roundup on registry editors and their importing capabilities if you need to get a registry editor to import scripts ):

[HKEY_LOCAL_MACHINE\SOFTWARE\Apps\Microsoft Application Installer]

(Please note that you donít need to import these keys and values - they are already existing, with different (false) values, which prohibit destination setting to be done.

With any registry editor, just go to HKEY_LOCAL_MACHINE\SOFTWARE\Apps\Microsoft Application Installer] and edit the two keys fAskOptions and fAskDest . As has already been mentioned, they contain zeros (meaning false). You'll need to change them to 1ís (meaning true: that is, do ask for the destination root directory).

This way, you wonít even need to use an import-capable registry editor and you wonít be forced to create a registry import file with the above contents that your particular reg. editor accepts.)

After all this all has been done and you can click a CAB file on your PDA right away (or, just install a program on your desktop that uses the standard ActiveSync dialog). Then, youíll be taken to the root of your target (the one that youíve asked for in ActiveSync, concerning the latter case) memory card/File Store:

Then, just navigate to the target directory:

And press OK (top right icon). Then, the program indeed will be installed in the parent directory youíve specified (see the target directory name in the dialog screen):

Two remarks:

- to download the two ZIP files, right-click the above Mad Programmer-links and choose Save target asÖ instead of directly clicking them; the latter would also mean a Referer HTTP header check and a subsequent error message.

- still regarding Mad Programmerís files, youíll need to copy the following files into your PDAís \Windows directory:

1. from, ARMRel\gsgetfile.dll
2. from, ARM\filedlgchg.cpl

Also, youíll need to start Settings/System/ File Dialog Changer and check in Exchange Standard File Dialog before youíll see any change (just press OK after doing this; you wonít need to click Add).

Note that thereíre a lot of other goodies Mad Programmer has written. You may want to read, for example, my review of the Force Hi-resolution tool V1.50/1.51 or my tips on using his Fonts on Storage. These two tools are also excellent.

Also note that thereíre some applications with custom-written installers that donít use CABís at all; with them, not even File Dialog Changer will work. Applications like this are, for example, Destinator, Pocket Promt (sic!) etc.

You may also want to read Gerardís excellent article on this subject.

EDIT at 18:59: corrected a mistake in the first section. Thanks for the iPAQ HQ forum people for pointing it out! Also, made the text a bit easier to read.
Reply With Quote
Old 07-25-2005, 04:43 PM
5000+ Posts? I Should OWN This Site!
Join Date: Jun 2007
Posts: 5,067

Iíve received many questions about why the destination dialog screen is needed at all and what makes it better than CabInstl. Well, it indeed has advantages if you need to do a mass-install from your desktop computer onto your storage card and want to install all your software into a common subdirectory (and not the default, that is, the root directory). Then, using the hack does indeed save a lot of time.

What I wasnít aware of while writing the above tutorial (and giving the thread a title ) is the bugginess of the redirection.

The main disadvantage is that, unless you use registry toggler tools (more on this later in the section on nscript ) to easily switch between the enabled/disabled state of the destination dialog screen, the installer of some programs just wonít work: the PPC will be reset as soon as the CAB is started on the PPC.

Some examples of apps that behave like this:
Resco xBall
All games of Astraware; Iíve tested Bejeweled (tested version 2.45; ) and Bejeweled 2 (tested version 1.2; )

They, however, work great if you install them through ActiveSync or CabInstl (tested with the latest version, 1.04). That is, thereíre cases (Astraware games etc) when using CabInstl is the only way to get some programs installed to non-RAM media without access to a desktop ActiveSync.

Please note that this is not a bug in Mad Programmerís File Dialog Changer but that of the Windows CE install-time dialog box redirection.

I need to point out another problem with enabling the destination dialog screen (again, with or without File Dialog Changer Ė itís another bug in WindowsCE): the alternative screen will only be activated if you give a non-RAM target to ActiveSync. This will, of course, result in (in cases, far) slower transferring of the initial CAB file to the device, especially with larger CAB files (for example, that of Adobe Acrobat 2.0). If you donít like the decreased speed introduced by this hack, you may want to stick to the default configuration (with or without CabInstl).

Bottom line: that is, I need to elaborate on the title of the the thread: it would be a killer if it worked with every CABís and with CABís (auto)copied into main memory. For the time being, you may want to stick to CabInst for offline installations or installations that require a common, non-root directory on your storage card (despite the need for hunting for ActiveSync-created CABís on the desktop in the latter case).

You may, despite the problems Iíve outlined above, still want to use the destination dialog screen (with or without the Mad Programmer utility), but want to make it easily switchable. If thatís the case, read on.

First, I elaborate a bit more on the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Apps\Microsoft Application Installer\fAskDest.

If you donít copy the two Mad Programmer files to your PDA (and enable the new file dialog), just enable this key (0 -> 1), youíll get the following screen each time a CAB is started either locally (by, say, clicking it) or by a remote ActiveSync process:

Here, you can choose in which directory to install your app and on which card. This may be enough for most purposes if you donít need, for example, built-in directory creation capabilities or multilevel directory tree navigation (both are offered by the Mad Programmer tool) because you already have the target directory (for example, \progs on your storage card) to install your files to and donít mind the ďflatĒ, one-dimensional format of the ďFolderĒ drop-down list.

Now, the important part: how can you quickly disable and enable the automatic destination dialog screen because of the problems with certain CABís and the need for telling ActiveSync a slower destination for the dialog screen to work?

Itís, fortunately, very easy. No, you donít need to fire up a registry editor, go to HKEY_LOCAL_MACHINE\SOFTWARE\Apps\Microsoft Application Installer\fAskDest and change the registry values every time you want to enable/disable this feature.

Nor need you define two registry import files to enable/disable redirection. (Iíve described a quick way of switching some values in the registry in my article here. This article describes implementing registry import-based solutions for problems that can be done with reg. imports - for example, as far as my tutorial is concerned, easy and fast HTTP proxy changing/enabling/disabling.) Thatís much cleaner but still involves two files because they donít contain any conditional execution logics: code that reads the current value of HKEY_LOCAL_MACHINE\SOFTWARE\Apps\Microsoft Application Installer\fAskDest and negates it.

Going the Ďletís write a program in native/managed code to toggle between the two statesí is indeed easy, but definitely not as flexible (you canít recompile it on your PDA; the EXE sizes are considerably larger than script sizes; distributing these files arenít as easy as script files which can be checked for ďvirusesĒ and ďbackdoorsĒ by anyone etc) as the one Iíll describe.

nscript to the rescue! (Please note that the latest version is 0.88 Ė their homepage still refers to 0.86, but the ZIP there already contains 0.88!) This utility was written by the same S_K people that wrote CabInstl and a lot of other great tools.

It offers a lot of features, including registry read/write, conditional logics, message boxes etc. The only missing feature is, IMHO, WinCE database read/write, but thatís not a big problem (for comparison: not even the Compact Framework 2 supports full access to all WinCE system databases, let alone 1.0/1.1, which have no way of accessing them without using native system calls).

Furthermore, its script programming code constructs (if/while/for; code blocks etc.) resemble C (and, therefore, Java, C#, C++) a lot. This means you donít even need to read the docs of the tool to be able to become productive in it if you already know at least one of those languages.

To install NS, you will need to uncompress ARMPPC\ns.exe from it and copy it anywhere on your PDA (preferably in \Program Files or on a non-RAM medium). It has no installer, so you will need to set file associations yourself: associate the ns file association with ns.exe. To do this, you may want to read my posts here on using Resco File Explorer or myExtensions. Note that youíll need to create a new entry for .ns files in myExtensions if you use that tool. Furthermore, if you prefer direct registry editing/imports (instead of using Resco File Explorer or myExtensions for extension mapping), you will need to import the following keys/values into the registry:


@=".ns Document"



@="\\ns.exe %1"


Note that you can assign a different icon to ns.exe if you accordingly set the default value of [HKEY_CLASSES_ROOT\nsfile\DefaultIcon].

Then, you only need to transfer a file with the .ns extension and the following contents to your PDA:

function main()
 subkey="\\SOFTWARE\\Apps\\Microsoft Application Installer";
 if (val == 0)
     puts("Install redirection ON");
     puts("Install redirection OFF"); 
What does this code do? After initializing two string variables, it reads the value of our registry key by giving a call to the rggetvalue() function. Note the val variable (it can be named anything!). The return value of rggetvalue() will be copied in it. Based on this return value, we go for insertng 0 or 1 to fAskDest. See how similar it is to C (except for being weak typed)? Yes, itís really great to code in this language if youíre a C/C#/Java/C++ guru! Not another f**** up scripting language syntax to learn!

After the file is copied to your PDA, you can just execute it by simply clicking it. ns.exe will be invoked, the new state will be displayed for a second (so youíll be able to see whether the redirection is off or on) and then, NS exits. You donít need to click anything, unlike with the registry import-based solution: you may know that you do need an additional click after the registry file is imported with all the regimport-capable registry editors. And, the need for two registry files is also a showstopper as far as the registry import file-based solution is concerned, while, in this case, you only have only one.

Please note that you can even put shortcuts to your .ns files (as, for example, this one) on your Today screen with, say, Spb Pocket Plus 2.x+ (Iíve described this it in the above article on the registry import-based solution) or with the free (!!) PHM TrayLaunch PowerToy. With the latter, after installing the program (you may need to copy c:\Program Files\PHM\PHM Pocket PC PowerToys\PHMPPCPT.Rpr_ARM.CAB to your device and execute it there to actually install the app Ė as with several other PHM apps, their MSI installers donít fire up the actual installation in ActiveSync with WM2003+ devices), go to Settings/System/Admin. Tools/PHM TrayLaunch, enable the Enable TrayLaunch checkbox and click Add. Here, enter the full path (!!) of the .ns file like below:

After this, press OK. You should now see your script listed in the PHM TrayLaunch main screen:

And the newly-added icon should also be displayed in the tray (at the bottom right; the new icon is the leftmost):

Are there alternatives to nscript as a great client-side scripting tool?

MortRunner, while itís a great scriting utility, still (as of version 2.6, released 20 July) doesnít have the same functionality as nscript. For example, it canít read (only write, delete and check for existence Ė in this case, where we need to read a value of an already-exiting subkey, itís useless) registry values. It doesnít know data types except DWORD and String either. Furthermore, it uses a scripting language that is not as similar to C as nscript.

The Pocket PC console tools described in my article, much as some has (semi-)decent scripting capabilities donít offer so good a system access than nscript or even MortRunner. They only have rudimentary programming contructs Ė the MS-DOS (if they implement them at all) batching capabilities are very limited. Furthermore, they canít access the registry, canít display dialog windows etc.
Reply With Quote
Old 09-24-2005, 09:31 AM
Join Date: Sep 2005
Posts: 1
Send a message via ICQ to CaRsaMyR Send a message via AIM to CaRsaMyR Send a message via MSN to CaRsaMyR Send a message via Yahoo to CaRsaMyR

I have an issue with the File Dialog Changer. It seems I am not able to install programs into sub-directories that already exist. For example, \Program Files\TMCP was created when I installed The Core Media Player. But when I went back and attempted to install the AC3 and Vorbis plugins (which must be in the same directory as TMCP) the dialog just changed to the directory \Program Files\TMCP and then waited for me to click the ok button. The problem with this is if I hit ok, then the plugins will be installed in a sub-directory of TCMP's program directory with the the name that was entered in the 'name' field. This however is not what I wanted. Is there anyway to work around this issue?

P.S. I noticed at one time when the file change dialog was brought up that (Install here) was set as the default input for the name field. I can't recall what I did to have this happen, but I fortunately it gave me the result that I was expecting in the issue I mentioned above. My program was installled into the default directory, however that was in the ram. I'm asking how to install a program inside an already existing sub-directory on an expansion card.

Hopefully, someone has also experienced this and can offer me some advice.
Reply With Quote
Old 10-31-2005, 11:59 AM
5000+ Posts? I Should OWN This Site!
Join Date: Jun 2007
Posts: 5,067

Note that the bug explained in my second (big) post only affects WM2003SE, not previous operating system versions. You may want to read my new tutorial on all these questions at
Reply With Quote
Old 01-11-2006, 04:01 PM
5000+ Posts? I Should OWN This Site!
Join Date: Jun 2007
Posts: 5,067

Please make sure you read for the latest bug/problem reports especially if you have a pre-WM2003SE device.
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +1. The time now is 09:11 AM.