mmioCreateChunk

The mmioCreateChunk function creates a chunk in a RIFF file that was opened by using the mmioOpen function. The new chunk is created at the current file position. After the new chunk is created, the current file position is the beginning of the data portion of the new chunk.

MMRESULT mmioCreateChunk(
  HMMIO hmmio,      
  LPMMCKINFO lpck,  
  UINT wFlags       
);

Parameters

hmmio

File handle of an open RIFF file.

lpck

Pointer to a buffer that receives a MMCKINFO structure containing information about the chunk to be created.

wFlags

Flags identifying what type of chunk to create. The following values are defined.

Value Meaning
MMIO_CREATELIST "LIST" chunk.
MMIO_CREATERIFF "RIFF" chunk.

Return Values

Returns MMSYSERR_NOERROR if successful or an error otherwise. Possible error values include the following.

Value Description
MMIOERR_CANNOTSEEK Unable to determine offset of the data portion of the chunk.
MMIOERR_CANNOTWRITE Unable to write the chunk header.

Remarks

This function cannot insert a chunk into the middle of a file. If an application attempts to create a chunk somewhere other than at the end of a file, mmioCreateChunk overwrites existing information in the file.

The MMCKINFO structure pointed to by the lpck parameter should be set up as follows:

  • The ckid member specifies the chunk identifier. If wFlags includes MMIO_CREATERIFF or MMIO_CREATELIST, this member will be filled by mmioCreateChunk.
  • The cksize member specifies the size of the data portion of the chunk, including the form type or list type (if any). If this value is not correct when the mmioAscend function is called to mark the end of the chunk, mmioAscend corrects the chunk size.
  • The fccType member specifies the form type or list type if the chunk is a "RIFF" or "LIST" chunk. If the chunk is not a "RIFF" or "LIST" chunk, this member does not need to be filled in.
  • The dwDataOffset member does not need to be filled in. The mmioCreateChunk function fills this member with the file offset of the data portion of the chunk.
  • The dwFlags member does not need to be filled in. The mmioCreateChunk function sets the MMIO_DIRTY flag in dwFlags.

Requirements

**  Windows NT/2000/XP:** Included in Windows NT 3.1 and later.
**  Windows 95/98/Me:** Included in Windows 95 and later.
**  Header:** Declared in Mmsystem.h; include Windows.h.
**  Library:** Use Winmm.lib.

See Also

mmioOpen, MMCKINFO, mmioAscend