How to: Initialize the Voice Recorder Control
The following code example shows how to initialize a Voice Recorder control.
// Be sure that the owner window exists.
if (!IsWindow(hwndMain)) return FALSE;
// Initialize the control's data structure.
CM_VOICE_RECORDER cmvr;
memset( &cmvr, 0, sizeof(cmvr));
cmvr.cb = sizeof(CM_VOICE_RECORDER);
cmvr.dwStyle = VRS_NO_MOVE;
cmvr.xPos = 100; // Use -1 to center the control relative to owner.
cmvr.yPos = 160;
cmvr.hwndParent = hwndMain;
cmvr.lpszRecordFileName = TEXT("\\My Documents\\MyVoiceRec.wav");
// Returns the handle to the control.
hwndVoice = VoiceRecorder_Create(&cmvr);
if (hwndVoice == NULL)
{
// VoiceRecorder_Create failed.
MessageBox(NULL, _T("Can't create Voice Recorder."),
_T("Warning"), MB_OK);
exit(0); // Replace with specific error handling.
}
See Also
How to: Intercept VRN_* Messages
How to: Program the Voice Recorder
Last updated on Friday, April 22, 2005
© 2005 Microsoft Corporation. All rights reserved.
Send feedback on this topic to the authors.