I wrote something about file associations on Windows CE just yesterday - it'll be on my website later, but here's the text...
As Chris recommends, you're best off using an installer, but here's the article all the same
Cheers,
Nick.
File Associations in Windows CE
File associations in Windows CE are handled through the registry: there is no "user friendly" way to manage file associations built into the operating system. For example, double click on something with a three letter extension that is not managed, and what do you get? A requester telling you to that there's no application associated with the file type, and that you should "run the application first, then open this file from within the application".
Helpful, eh?
The solution is fairly straightforward, but is best off left to either an installation routine or an application initiation routine as it involves adding entries to the registry.
To associate a file with an application, you need to create four entries in the HKEY_CLASSES_ROOT registry hive:
- a mapping between the extension and class name
(ie .xyz to xyzfile
)
- a class name with description of what that file type is that will mean something to the user
(ie xyzfile to "XYZZY data file"
- A pointer to the default icon to use for the class in explorer
- The command with which to open the file type
As an example, let's show adding the ".z5"
(Infocom Story file
) extension to a machine to be opened by FrotzCE
(an infocom interpreter
). The following keys would be needed:
HKCR\.z5 with the default value set to "z5game"
HKCR\z5game with the default value set to "Infocom Story File"
HKCR\z5game\DefaultIcon set to the path to FrotzCE, followed by the icon number to use from the file. As an example "\Program Files\FrotzCE\FrotzCE.exe," will use the first icon in the application
HKCR\z5game\Shell\Open\Command set to the path to FrotzCE with any parameters to pass. The filename is stored in the variable %1%, so something along the lines of '"\program files\frotzce\frotzce.exe" %1'.
The best place to set this up is within a CabWiz installation file. One thing to be aware of is the handling of quote marks within CabWiz, and also of % symbols, which are used for internal variables.
Here's an example from the CabWiz INI file for MagnetiCE, which associates .mag files with the installed application:
[RegSettings]
HKCR,.mag,,,magfile
HKCR,magfile,,,"MagnetiCE Game file"
HKCR,magfile\DefaultIcon,,,"%InstallDir%\MagnetiCE.exe,"
HKCR,magfile\Shell\Open\Command,,,""""%InstallDir%\MagnetiCE.exe"""" %%1