Home   Index   About
Ultimate Pack


Custom Search
File and Stream Handler Installation

The AVIFile library uses installed stream and file handlers for reading and writing AVI files and streams. A handler is installed when it resides in the Windows SYSTEM directory and the registry contains the following information needed to describe and identify a handler:

  • The 16-byte class identifier for the handler

  • A brief description of the handler

  • The name of the file containing the handler

  • The file extension that a file handler can process

  • File-access and other properties associated with a file handler

  • Four-character codes identifying stream types that a stream handler can process

The AVIFile library queries the registry for handlers that are external to an application when opening files and accessing streams. The result of a successful query returns the filename of a handler that can process the file or stream type specified in the query. The registry lists each handler by creating three entries that have the following form:

[HKEY_CLASSES_ROOT\Clsid\{00010023-0000-0000-C000-000000000046}]

@="Wave File reader/writer"

[HKEY_CLASSES_ROOT\Clsid\{00010023-0000-0000-C000-

000000000046}\InprocServer32]

@="wavefile.dll"

"ThreadingModel"="Apartment"

[HKEY_CLASSES_ROOT\Clsid\{00010023-0000-0000-C000-

000000000046}\AVIFile]

@="3"

These entries consist of the following parts.

Part
Description
HKEY_CLASSES_ROOT
Identifies the root entry of the registry.
Clsid
Identifies this entry as a class identifier.
{00010023-0000-0000-C000-000000000046}
Specifies an interface identifier (IID) or class identifier. This value is a unique 16-byte identifier. (The identifier might also be referred to as a GUID or a UUID in other manuals.)
Wave File reader/writer
Specifies a string to describe the handler. This string can be displayed in dialog boxes for selecting stream and file handlers.
InProcServer32
Specifies the file (in this example, WAVEFILE.DLL) that can be loaded to handle this class.
AVIFile
Specifies the properties of a file handler. In this example, the handler can read and write to an AVI file.

A file handler can have one or more of its properties stored in the registry. The following constants identify the properties currently associated with a file.

Constant
Description
AVIFILEHANDLER_CANACCEPTNONRGB
Indicates that a file handler can process image data other than RGB.
AVIFILEHANDLER_CANREAD
Indicates that a file handler can open a file with read access.
AVIFILEHANDLER_CANWRITE
Indicates that a file handler can open a file with write access.

When creating a file or stream handler, you can obtain a new identifier by running UUIDGEN.EXE. Always use UUIDGEN.EXE to create a new identifier. The 16-byte hexadecimal number created by this executable will uniquely identify your handler.

The AVIFile library uses additional entries in the registry to identify a class identifier based on the file extension that a file handler can process or a four-character code that a file or stream handler can process. For example, the following entries associate a class identifier with the file extension .WAV and the four-character code "WAVE":

[HKEY_CLASSES_ROOT\AVIFile\Extensions\WAV]

@="{00010023-0000-0000-C000-000000000046}"

[HKEY_CLASSES_ROOT\AVIFile\RIFFHandlers\WAVE]

@="{00010023-0000-0000-C000-000000000046}"

These entries consist of the following parts.

Part
Description
HKEY_CLASSES_ROOT
Identifies the root entry of the registry.
AVIFile
Identifies this entry as an entry used by AVIFile.
Extensions
Specifies the file extension (in this example, .WAV) that a file handler can process.
RIFFHandlers
Specifies the four-character code (in this example, "WAVE") a file or stream handler can process.
{00010023-0000-0000-C000-000000000046}
Specifies an interface identifier (IID) or class identifier.

If you distribute your stream or file handler without a setup application to install it in the user's system, you must include a .REG file so the user can install the handler. The user will use the registry editor to create registry entries for your stream or file handler.

The following example shows the contents of a typical .REG file. The first entry in the following example is the descriptive string for the handler. The second entry identifies the file containing the handler. The third entry identifies the properties of the file handler (in this case, read-only access to files). The fourth entry associates the type of file the handler processes (in this case, files with a .JPG filename extension) with the class identifier.

[HKEY_CLASSES_ROOT\Clsid\{5C2B8200-E2C8-1068-B1CA-6066188C6002}]

@="JFIF (JPEG) Files"

[HKEY_CLASSES_ROOT\Clsid\{5C2B8200-E2C8-1068-B1CA-6066188C6002}]\InprocServer32]

@="jfiffile.dll"

[HKEY_CLASSES_ROOT\AVIFile\Extensions\JPG]

@="{5C2B8200-E2C8-1068-B1CA-6066188C6002}"

When creating this file, save it with a .REG extension to identify it as an update file for the registry. Also, substitute a unique IID for the 16-byte code used in the example.

Users can update the registry on their system by using the following procedure:

  1. Click the Start menu (or run Program Manager and click the File menu), then click Run.

  2. In the Run dialog box, type the following command and press ENTER:

regedit -s filename.reg


Last news from Greatis Software

Nostalgia .Net     Nostalgia .Net     .Net is powerful, but not all-powerful, so sometimes we need to use Win32 API for our .Net applications. It's simple enough with Platform Invoke if you have Win32 skill, but we do not always have time to dig the ancient documentation, declare the special types that are compatible with Win32, find the values of the Win32's constants and so on. Nostalgia .Net offers several simple-to-use classes, and components that will allow you to forget about the headache of Win32 and just use the power of Win32 in your application the same way as you use the native. Net classes.  More »

Recommended software for developers

Ultimate Pack for Delphi and C++ Builder     Ultimate Pack     Component pack for Delphi and C++ Builder that contains runtime form designer, runtime object inspector, print suite and much more for the very special price.  More »

Form Designer .Net     Form Designer .Net     Unique runtime form design solution that allows to edit any form in .Net WinForms application at runtime with full source codes for only 300 euro!  More »

Print Suite .Net     Print Suite .Net     Print Suite .Net is a set of components for easy printing texts, images and grids from your WinForms applications. Full C# source codes are available  More »

Gradient Controls .Net     Gradient Controls .Net     Gradient Controls .Net offers controls with gradient background feature. Labels, panels and so on... Full C# source codes are available  More »

iGrid     Greatis iGrid     iGrid plots drawing grid right over your desktop, so you can use it everywhere, with any drawing application without any special plugins for different graphic editors.  More »


All the contacts and projects

Dmitry Vasiliev (just.dmitry)

Related Links

Software for Visual Studio .NET developers
Software for Delphi and C++ Builder developers
Software for Visual Basic 6 developers
Delphi Tips&Tricks
MegaDetailed.NET

More Online Helps

Win32 Programmer's Reference
Win32 Multimedia Programmer's Reference
OLE Programmer's Reference
Microsoft Windows Pen API Programmer's Reference
Microsoft Windows Sockets 2 Reference
Microsoft Windows Telephony API (TAPI) Programmer's Reference
Unix Manual Pages

Free Tech Secrets ;) Copyright © 2008-2012 Free Tech Secrets ;) greatis just4fun network just4fun