82.8.3 Installing an I/O Procedure

Use mmioInstallIOProc to install, remove, or locate an I/O procedure. The mmioInstallIOProc function has the following syntax:

LPMMIOPROC mmioInstallIOProc(fccIOProc, pIOProc, dwFlags)

The fccIOProc parameter specifies the filename extension associated with the I/O procedure. Use a four-character code to specify the extension. All characters in the four-character code must be uppercase characters.

The pIOProc parameter specifies a far pointer to the I/O procedure being installed. If the I/O procedure resides in the application (rather than being in a DLL), use MakeProcInstance to get a procedure-instance address and specify this address for pIOProc. If you are removing or locating an I/O procedure, pIOProc should be NULL.

The dwFlags parameter specifies whether to install, remove, or locate the specified I/O procedure. Specify one of the following flags for dwFlags: MMIO_INSTALLPROC, MMIO_REMOVEPROC, or MMIO_FINDPROC.

The return value is the address of the I/O procedure installed, removed, or located. If there is an error, the return value is NULL.

For example, to install an I/O procedure associated with the filename extension “ARC”, use the following statement:

mmioInstallIOProc (mmioFOURCC('A', 'R', 'C', ' '),

(LPMMIOPROC)lpmmioproc, MMIO_INSTALLPROC);

Note:

Be sure to remove any I/O procedures you've installed before exiting your application.

82.8.3.1 Installing an I/O Procedure Using MmioOpen

When you install an I/O procedure using mmioInstallIOProc, the procedure remains installed until you remove it. The I/O procedure will be used for any file you open if the file has the appropriate filename extension. You can also tempo- rarily install an I/O procedure using mmioOpen. In this case, the I/O procedure is only used with a file opened by mmioOpen and is removed when the file is closed using mmioClose.

To specify an I/O procedure when you open a file using mmioOpen, use the lpmmioinfo parameter to reference an MMIOINFO structure as follows:

Set the fccIOProc field to NULL.

Set the pIOProc field to the procedure-instance address of the I/O procedure.

Set all other fields to zero (unless you are opening a memory file, or directly reading or writing to the file I/O buffer).