title: How to properly use mciSendString
body: <p>I play an MP3 sound using the following <code>mciSendString</code></p>
  
  <p><code>mciSendString("play \"mysound.mp3\"", NULL, 0, 0);</code></p>
  
  <p>The above works just fine. But from what I've seen around the web, people use all kinds of wrappers for the above code. Some first send <code>open</code> command then <code>play</code>, then wait for notification, then send <code>close</code> command, they also use aliases for files etc.</p>
  
  <p>My question is - is all this necessary? My primary interest is just to play a file and do it in async manner. The above command appears to do all the cleanup so my question is - is it really required to use <code>open</code> or <code>close</code> command and notifications when the sound has been played to properly release memory and deallocate sound and is there an advantage to doing so.</p>
  
  <p>From what I can see in the debugger it appears that on execution of above command the system loads required DLLs, then starts some threads and as soon as the playback ends, the threads exit and the DLLs are unloaded. So my guess is that open/close are optional because the system does all the allocation/deallocation automatically, but I may be wrong. Am I leaking some memory or resources if I just call the above line and nothing else?</p>
  
  <p>Here is what the debug log shows - all I can conclude from this log that the thread is closed and that the the DLL files are unloaded:</p>
  
  <pre><code>Module Load: MCIQTZ32.dll. No Debug Info. Base Address: $61D80000. Process Project1.exe (368)
  Thread Start: Thread ID: 492. Process Project1.exe (368)
  Module Load: SETUPAPI.dll. No Debug Info. Base Address: $77920000. Process Project1.exe (368)
  Module Unload: SETUPAPI.dll. Process Project1.exe (368)
  Thread Start: Thread ID: 1344. Process Project1.exe (368)
  Thread Start: Thread ID: 640. Process Project1.exe (368)
  Thread Exit: Thread ID: 1344. Process Project1.exe (368)
  Thread Exit: Thread ID: 640. Process Project1.exe (368)
  Thread Start: Thread ID: 468. Process Project1.exe (368)
  Thread Start: Thread ID: 1120. Process Project1.exe (368)
  Module Load: SETUPAPI.dll. No Debug Info. Base Address: $77920000. Process Project1.exe (368)
  Module Unload: SETUPAPI.dll. Process Project1.exe (368)
  Thread Start: Thread ID: 1692. Process Project1.exe (368)
  Thread Start: Thread ID: 1384. Process Project1.exe (368)
  Thread Start: Thread ID: 204. Process Project1.exe (368)
  Thread Start: Thread ID: 1572. Process Project1.exe (368)
  Thread Exit: Thread ID: 1692. Process Project1.exe (368)
  Thread Exit: Thread ID: 1384. Process Project1.exe (368)
  Thread Exit: Thread ID: 1572. Process Project1.exe (368)
  Thread Exit: Thread ID: 204. Process Project1.exe (368)
  Thread Exit: Thread ID: 1120. Process Project1.exe (368)
  Thread Exit: Thread ID: 468. Process Project1.exe (368)
  Module Unload: MCIQTZ32.dll. Process Project1.exe (368)
  Thread Exit: Thread ID: 492. Process Project1.exe (368)
  </code></pre>