How to: Intercept VRN_* Messages

The Voice Recorder control dispatches VRN_* messages in the WM_NOTIFY format to your application window whenever the control changes. Any WM_NOTIFY message sent from the Voice Recorder application has lParam point to a NM_VOICE_RECORDER structure. The NM_VOICE_RECORDER structure holds the VRN_* messages and an optional error code. The following code example shows how to intercept VRN_* messages.

Note   The following example does not use the error code passed in with NM_VOICE_RECORDER. Therefore, lParam is cast as an LPNHDR.

case WM_NOTIFY 
{
    LPNMHDR pnmh = (LPNMHDR) lParam;
    switch (pnmh->code);
    {
        case VRN_ERROR:
            MessageBox(NULL, TEXT("Error..."), NULL, MB_OK);
            break;
        case VRN_RECORD_START:
            MessageBox(NULL, TEXT("Recording..."), NULL, MB_OK);
            break;
        case VRN_RECORD_STOP:
            MessageBox(NULL, TEXT("Stop recording..."), NULL, MB_OK);
            break;
        case VRN_PLAY_START:
            MessageBox(NULL, TEXT("Playing..."), NULL, MB_OK);
            break;
        case VRN_PLAY_STOP:
            MessageBox(NULL, TEXT("Stop playing..."), NULL, MB_OK);
            break;
        case VRN_CANCEL:
            MessageBox(NULL, TEXT("Cancel..."), NULL, MB_OK);
            break;
        case VRN_OK:
            MessageBox(NULL, TEXT("OK..."), NULL, MB_OK);
            break;
        default:
            return DefWindowProc(hwnd, msg, wp,lp);
    }
}

See Also

How to: Initialize the Voice Recorder Control

How to: Program the Voice Recorder

Voice Recorder Control

Windows Mobile Controls

Last updated on Friday, April 22, 2005

© 2005 Microsoft Corporation. All rights reserved.

Send feedback on this topic to the authors.