Handling the DRV_OPEN and DRV_CLOSE Messages

Like other installable drivers, client applications must open a video compression and decompression driver before using it, and they must close it when finished using it so the driver will be available to other applications. When a driver receives an open request, it returns a value that the system will use for dwDriverID sent with subsequent messages. When your driver receives other messages, it can use this value to identify instance data needed for operation. Your drivers can use this data to maintain information related to the client that opened the driver.

Compression and decompression drivers should support more than one client simultaneously. If you do this, though, remember to check the dwDriverID parameter to determine which client is being accessed.

If the driver is opened for configuration by the Drivers option of the Control Panel, lParam2 contains zero. When opened this way, your driver should respond to the DRV_CONFIGURE and DRV_QUERYCONFIGURE messages.

If opened for compression or decompression services, lParam2 contains a far pointer to an ICOPEN data structure. The fccType member of ICOPEN specifies a four-character code representing the type of stream being compressed or decompressed. For video streams, this will be 'vidc'.

Because video capture drivers can rely on video compression and decompression drivers for efficient operation, a single driver can handle both video capture, and video compression and decompression services. Video capture drivers use the VIDEO_OPEN_PARMS data structure when it is opened. This structure has the same member definitions as the ICOPEN structure. By examining the fccType member, a combined driver can determine whether it is being opened as a video capture driver or a video compression and decompression driver. Video capture devices contain the four-character code 'vcap' in this member. For more information on video capture drivers, see .

Other drivers that require close coordination with video compression and decompression drivers can also be combined with video compression and decompression drivers if they use a similar interface.

The fccHandler member of ICOPEN specifies a four-character code identifying a specific compressor. The client-application obtains the four-character code from the entry in the SYSTEM.INI file used to open your driver. Your driver should not fail the open if it does not recognize the four-character code.

The dwVersion member of ICOPEN specifies the version of the compressor interface used to open the driver. Your driver can use this information to determine the capabilities of the system software when future versions of it are available.

The dwFlags member of ICOPEN contains a constant indicating the function of the driver. The following functions are defined for video compression drivers: compressing data, decompressing data, interrogation, and decompressing and draw directly to hardware.

The ICMODE_COMPRESS, ICMODE_DECOMPRESS, and ICMODE_DRAW flags indicate your driver is opened to compress or decompress data. Depending on the flag, your driver should prepare to handle ICM_COMPRESS, ICM_DECOMPRESS, ICM_DECOMPRESSEX, or ICM_DRAW messages. Your driver should also prepare to handle all messages used to configure and interrogate your driver.

The ICMODE_QUERY flag indicates your driver is opened to obtain information. It should prepare to handle the ICM_ABOUT, ICM_GETINFO, and ICM_GETDEFAULTQUALITY messages.