Can anyone of me tell me how to create two threads in vc++, one thread should record the audio from microphone and copy to a buffer and the other should read from the buffer and play. These have to run simultaneously. There and be 10 buffers where the recorded data is copied, one played from a buffer the same can be used to record again.
The following code snippet does that Code: DWORD CPipeSampleDlg::CreatePipeThread() { DWORD dwThreadId = 0; m_hPipeThread = ::CreateThread(0, 0, (LPTHREAD_START_ROUTINE)StartPipeThread, this, CREATE_SUSPENDED, &dwThreadId); ASSERT(m_hPipeThread); ::SetThreadPriority(m_hPipeThread,THREAD_PRIORITY_IDLE); if( !m_hPipeEvent ) m_hPipeEvent = ::CreateEvent( NULL, FALSE, FALSE, _T("StartUpdateDirectoryThread") ); else ::ResetEvent(m_hPipeEvent); ::ResumeThread(m_hPipeThread); return dwThreadId; } This is the code snippet from the following sample [thread=864]Interprocess communication through Named pipes[/thread]. You can download the sample and see it working as well.