How to: Intercept VRN_* Messages

Send Feedback

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.

Code Example

The following code example demonstrates how to intercept VRN_* messages.

Note   To make the following code example easier to read, security checking and error handling are not included. The example does not use the error code passed in with NM_VOICE_RECORDER. Therefore, lParam is cast as an LPNHDR. This code example should not be used in a release configuration unless it has been modified to include them.

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

Creating Windows Mobile Controls | How to: Initialize the Voice Recorder Control | How to: Program the Voice Recorder | Voice Recorder Control

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.