Microsoft DirectX 8.1 (C++)

Step 4: Close Down

To exit an audio application cleanly, you must perform four main steps:

The following sample code from the WinMain function in the tutorial sample is called when the dialog box is closed.

  g_pPerformance->Stop(
    NULL, // Stop all segments.
    NULL, // Stop all segment states.
    0,  // Do it immediately.
    0   // Flags.
  );
 
  g_pPerformance->CloseDown();
 
  g_pLoader->Release(); 
  g_pPerformance->Release();
  g_pSegment->Release();
 
  CoUninitialize();
    
  return 0;  // Return value for WinMain.
}      // End of WinMain.