Registering a File Filter (Windows CE 5.0)

Send Feedback

An application registers a file filter by placing its CLSID in the following registry key locations:

  • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows CE Services\Filters

  • .file extension\InstalledFilters

    This registration associates the file filter with the file type it converts.

  • HKEY_CLASSES_ROOT\CLSID

    This registration provides information on the file filter's capabilities and its DLL.

ActiveSync uses device partnerships to allow Windows CE–based devices with different file filter setups to be connected to the same desktop computer. If device partnerships exist when an application registers a file filter, an application must create a file filter extension key for each existing device partnership. Connecting a Windows CE-based device to a desktop computer for the first time establishes a new device partnership with a unique identifier. Windows CE-based devices use the partnership identifier to store unique settings for synchronization, file conversions, and backup-and-restore information.

All filters registered under the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows CE Services\Filters key are copied to the **HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows CE Services\Partners\**partner-identifier key, where partner-identifier is the identifier of the new device partnership.

A file type can have more than one file filter associated with it. The ActiveSync user interface lists the registered filters as filter options. A file filter can be registered under the file type's InstalledFilters key in the DefaultImport or DefaultExport subkeys. As their names imply, these subkeys define the default file filters for the file type. The file filter specified 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 value must also be an InstalledFilters value.

A file filter can also be registered for a particular target device or OS design. The file filter extension subkey needs to be created under the HKEY_LOCAL_MACHINE\SOFTWARE\Windows CE Services\SpecialDefaults\<OS Design Name>\Filters key.

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 CLSIDs for this extension]
    ...
    [more extensions]

The HKEY_CLASSES_ROOT\CLSID key provides basic information about 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 structure for this key and its subkeys.

HKEY_CLASSES_ROOT\CLSID
   \clsid
      \(Default) = <description in "Edit Conversion Settings" list>
      \DefaultIcon = <file name,index for the icon for this type>
      \InProcServer32 = <file name of DLL that handles this type>
         ThreadingModel = Apartment
      \PegasusFilter
         [Import]
         [HasOptions]
         Description = <string to display in conversion dialog box>
         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.

  • DefaultIcon, which defines the icon name string or icon resource identifier for the icon associated with the file filter DLL.
  • InProcServer32, which identifies the file filter DLL using the default value, and defines the apartment model capabilities of the file filter in the ThreadingModel named value.
  • PegasusFilter, which provides information about the specific capabilities of the file filer.

The following table shows possible named values for the PegasusFilter subkey.

Named value Description
Import If this named value exists, the conversion type is for the Windows CE-based device importing files from the desktop. Otherwise, the conversion type is for the Windows CE-based device exporting files to the desktop.
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. ActiveSync displays this text on the property sheets that are displayed by selecting the DeviceDesktop or DesktopDevice tab control selections in the File Conversion Properties dialog box, then choosing Edit to display the Edit Conversion Settings dialog box.

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

NewExtension Defines the extension of the file that will be created on the destination Windows CE-based device.

Sample File Filter Registry Entry

The following is a sample registry editor (.reg) file used to register the bitmap image file filter converter. This file can be used to convert a BMP-format file to a 2BP-format file. The last three entries register the .2bp file extension to be displayed with a specific icon and name.

**Note   **The 2bp.dll file converter is registered and installed when ActiveSync is installed on the desktop computer.

REGEDIT4
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows CE Services\Filters\.bmp]
    "DefaultImport"="{DA01ED80-97E8-11cf-8011-00A0C90A8F78}"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows CE
    Services\Filters\.bmp\InstalledFilters]
"{DA01ED80-97E8-11cf-8011-00A0C90A8F78}"=""
    [HKEY_CLASSES_ROOT\CLSID\{DA01ED80-97E8-11cf-8011-00A0C90A8F78}]
    @="Bitmap Image"
[HKEY_CLASSES_ROOT\CLSID\{DA01ED80-97E8-11cf-8011-    00A0C90A8F78}\DefaultIcon]
    @="c:\Program Files\Windows CE Services\2bp.dll,-1000"
[HKEY_CLASSES_ROOT\CLSID\{DA01ED80-97E8-11CF-8011-00A0C90A8F78}\
    InProcServer32]
    @="2bp.dll"
    "ThreadingModel"="Apartment"
[HKEY_CLASSES_ROOT\CLSID\{DA01ED80-97E8-11cf-8011-00A0C90A8F78}\
    PegasusFilter]
    "Import"=""
    "Description"="Bitmap Image."
    "NewExtension"="2bp"
[HKEY_CLASSES_ROOT\.2bp]
    @="2bpfile"
[HKEY_CLASSES_ROOT\2bpfile]
    @="Bitmap Image"
[HKEY_CLASSES_ROOT\2bpfile\DefaultIcon]
    @="c:\Program Files\Windows CE Services\minshell.dll,-2025"

See Also

Converting File Formats

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.