The following example records waveform audio using the built-in controls of the MCIWnd window. The example creates an MCIWnd window by using the MCIWNDF_RECORD window style with the MCIWndCreate function to add a Record button to the toolbar. The MCIWndNew macro indicates a new file is associated with the MCIWnd window and that a waveform-audio device will provide its content. A second menu command, IDM_SAVEMCIWND, lets the user save the recording and select a filename by using the MCIWndSaveDialog macro.
case WM_COMMAND:
switch (wParam) {
case IDM_CREATEMCIWND:
g_hwndMCIWnd = MCIWndCreate(hwnd, g_hinst,
WS_VISIBLE | MCIWNDF_RECORD, NULL);
MCIWndNew(g_hwndMCIWnd, "waveaudio");
break;
case IDM_SAVEMCIWND:
MCIWndSaveDialog(g_hwndMCIWnd);
break;
}