Go4Expert

Go4Expert (http://www.go4expert.com/)
-   MFC (http://www.go4expert.com/forums/mfc/)
-   -   Terminate Thread (http://www.go4expert.com/forums/terminate-thread-t24199/)

sukhrajsingh 17Dec2010 13:14

Terminate Thread
 
Hi,
I am createing a thread in my mfc application in which I am playing video using Direct Show. But when I terminate thread then I am getting memory leak problem.
Please help me as soon as possible.
Following is code in which I am terminating thread:
Code:

if(m_pEditViewMC != 0)
        {
                m_pEditViewMC->Stop();
                m_PrevuBtnSate = PrevuOFF;
                m_pEditViewMC = 0;
        }
        if(m_PreviewThread)
        {
                DWORD exitcd;
                BOOL bThrState = GetExitCodeThread(m_PreviewThread->m_hThread, &exitcd);
                if(bThrState && (exitcd == STILL_ACTIVE))
                {
                        TerminateThread(m_PreviewThread->m_hThread, 0);
                        delete m_PreviewThread;
                        m_PreviewThread = 0;
                }
        }
        CleanVMR9();
        /*m_btnStopPreview.EnableWindow(false);
        m_btnPlayPreview.EnableWindow(true);*/
        if(!m_bDeavtivateOnce){
                ToggleStartStop(true);
        }
        else
                m_bDeavtivateOnce = !m_bDeavtivateOnce;
        this->SetFocus();

Thanks and Regards,
Sukhraj Singh


All times are GMT +5.5. The time now is 17:38.