Opening a File with mmioOpen

[The feature associated with this page, Multimedia File I/O, is a legacy feature. It has been superseded by Source Reader. Source Reader has been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use Source Reader instead of Multimedia File I/O, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

To open a file for basic I/O operations, set the lpmmioinfo parameter of the mmioOpen function to NULL. The following example opens a file named "C:\SAMPLES\SAMPLE1.TXT" for reading, and checks the return value for error.

HMMIO hFile; 

if ((hFile = mmioOpen("C:\\SAMPLES\\SAMPLE1.TXT", NULL, 
    MMIO_READ)) != NULL) 
    // File opened successfully. 
else 
    // File cannot be opened. 

Use the dwFlags parameter of mmioOpen to specify flags for opening a file.