Article ID: 133064
Article Last Modified on 11/1/2006
{ // Sample code to demonstrate SND_MEMORY flag and memory files.
// Sound resource bound within executable.
if (hWaveRes = FindResource(ghInst,"TADA","WAVE"))
{ // Resource intact; load into GLOBAL MEMORY/GMEM_SHARED memory
if (hGlobMem = LoadResource(ghInst,hWaveRes))
{ // Load resource into global memory and play.
// Play sound resource via sndPlaySound() using
// SND_MEMORY flag.
// Application waits until sndPlaySound completes
// given SND_SYNC.
// SND_MEMORY (first parameter is ptr to memory image
// vs. filename).
sndPlaySound((LPSTR)LockResource(hGlobMem),
SND_SYNC | SND_MEMORY);
FreeResource(hGlobMem); // Required in 16-bit
// applications.
} // Load resource into global memory and play.
else MessageBox(NULL,"No resource!","Multimedia Sampler!",
MB_ICONHAND);
GlobalFree(hGlobMem);
} // Resource found.
else MessageBox(NULL,"Lost resource!","Multimedia Sampler!",
MB_ICONHAND);
}
Additional query words: kbinf win16sdk mmio mmioOpen mmioRead
Keywords: kbinfo KB133064