当我关闭exe时,它的状态不会从任务管理器中删除. [英] When i close exe then its istantce is not removed from the task manager.

查看:69
本文介绍了当我关闭exe时,它的状态不会从任务管理器中删除.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

M每当我运行我的应用程序时,它都可以正常工作,但是当我用gui上的关闭按钮终止它时,它的实例将连续出现在任务管理器中.
我必须手动终止它.
M为关闭按钮提供代码.

M Whenever i run my application it works fine but when i terminate it with close button on gui then its instance continuously present in task manager.
I have to manually terminate it .
M giving code for close button.

void CFace_RecognitionDlg::OnBnClickedClose()  // Close the dialog box 
{
    if(dbNames)                  //Deallocating the array of CString
    {
        delete [] dbNames;
        dbNames = NULL;
    }
    KillTimer(TIMER_STREAM_PREVIEW);    //Timer to preview 
                                        //the camera stream on dialog 
                                        //killing that preview timer.

    //Deinitialize Web Camera interface.
    capCaptureStop(hWndC);
    capDriverDisconnect(hWndC);
    hWndC=NULL;
    
    m_hBmp=NULL;
    dcMem.Detach();
    //Update UI accordingly
    UpdateData(false);
    InvalidateRect(m_rectFrame);
    OnPaint();
    CDialog::OnClose();
    PostQuitMessage(0);
}



任何人都可以提出解决方案的建议.


问候
Ramkrishna



Can anybody suggest solution for it.


Regards
Ramkrishna

推荐答案

当您的应用程序没有终止时,您应该查看项目的CWinApp部分,例如InitInstance()和ExitInstance().
When your application doesn''t terminate, you should look in the CWinApp part of your project, e.g. InitInstance() and ExitInstance().


ramkrishna.jangale写道:
ramkrishna.jangale wrote:

CDialog :: OnClose() ;
PostQuitMessage(0);

CDialog::OnClose();
PostQuitMessage(0);



删除CDialog::OnClose()PostQuitMessage(0);

而是调用CDialog::OnCancel()来关闭基于对话框的应用程序.

另一位发帖人提到,某些工作线程可能正在运行,从而使应用程序保持活动状态.错了这样的事情在本地语言程序(如C ++)中永远不可能发生.当主线程停止运行时,所有其他线程都会突然终止.



Remove CDialog::OnClose() and PostQuitMessage(0);

Call CDialog::OnCancel() instead to shut down a dialog based application.

Another poster mentioned that some worker thread may be running, keeping the app alive. That''s wrong. Such a thing can can never happen in a native language program (like C++). When the main thread comes to a halt, every other thread will be killed abruptly.


您是否在此应用中使用UI线程以外的任何线程?

如果是,则那些其他线程可能仍在运行并保持应用程序打开.

希望对您有帮助
Are you using any threads other than the UI thread in this app?

If yes those other thread(s) might still be running and keeping the application open.

Hope this helps


这篇关于当我关闭exe时,它的状态不会从任务管理器中删除.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆