Registering a File Filter

A file filter is registered by placing its CLSID in two locations. The first place is under the file type's extension key in the InstalledFilters subkey. This registration associates the file filter with the file type it converts. The other place to register a file filter is under the HKEY_CLASSES_ROOT\CLSID key. This registration provides information on the file filter's capabilities and its DLL.

Optionally, a file filter can be registered under the file type's extension key as the DefaultImport or DefaultExport named value. As the names imply, these values define the default file filters for the file type.

Each key under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\
Windows CE Services\Filters
is the name of a file extension. This is called the file type's extension key. Under each extension key is the InstalledFilters subkey, which contains the CLSID of each file filter that can convert this file type. The CLSID must identify an OLE Component Object Model (COM) object that is used for the conversion. The filters that are registered under the InstalledFilters subkey will be listed in the Windows CE Services user interface as filter options. Whichever file filter is also listed under the extension key as the DefaultImport or DefaultExport value will be shown as the default.

Note Any filter defined as the DefaultImport or DefaultExport named value must be an InstalledFilters value also.

The following is the structure of the Filters key and the InstalledFilters subkey.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows CE Services\Filters

   \.<file extension>
      [DefaultImport = <Default import filter CLSID>]
      [DefaultExport = <Default export filter CLSID>]
      \InstalledFilters
         [<clsid1>]
         . . .
         [more CLSID's for this extension]
    . . .
    [more extensions]

The HKEY_CLASSES_ROOT\CLSID key gives basic information concerning file filters. Each file filter that has been identified in the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows CE Services\Filters key must be registered in this key. The following is the key's structure and its subkeys.

HKEY_CLASSES_ROOT\CLSID

   \<clsid>
      \(Default) = <Description in "Edit Conversion Settings" listbox>
      \DefaultIcon = <filename,index for the icon for this type>
      \InProcServer32 = <filename of the DLL that handles his type>
         ThreadingModel = Apartment
      \PegasusFilter
         [Import]
         [HasOptions]
         Description = <String to display in the conversion dialog>
         NewExtension = <extension of converted file>
   \. . . [more clsids for filters]

The clsid key is a named value that is the CLSID of the registered file filter. This key contains the following subkeys:

Named Value Description
Import If this named value exists, the conversion type is for importing files from the desktop computer to the Windows CE-based device. Otherwise, the conversion type is for exporting files from the desktop computer to the Windows CE-based device.
HasOptions If this named value exists, the file filter supports the ICeFileFilter::FilterOptions method.
Description The data for this named value is a string that describes the conversion. Windows CE Services displays this text on the property sheets displayed by selecting the DeviceDesktop or DesktopDevice tab control selections from the File Conversion Properties dialog box and then clicking the Edit button to display the Edit Conversion Settings dialog box.

For example, if the Import named value exists, then, on the DesktopDevice property sheet, the data value defined by the Description named value will be displayed under the file conversions details "Convert to HPC files of the type."

NewExtension Defines the extension of the file that will be created on the destination device.