如果程序有多个窗口,在其它的窗口没有关闭的情况下关闭主窗口后,我想让程序结束。
我的做法是在主窗口函数响应WM_DESTROY消息时调用ExitThread(0)和TerminateThread(GetCurrentThread(),0)程序无法退出,要使用TerminateProcess或者ExitProcess才可以我的问题是
1、MessageBox函数是如何解决在消息框没有关闭的情况下而关闭了主窗口后,使整个程序都结束的?
2、ExitThread、TerminateThread为什么不可以结束一个单线程的程序呢?
我的做法是在主窗口函数响应WM_DESTROY消息时调用ExitThread(0)和TerminateThread(GetCurrentThread(),0)程序无法退出,要使用TerminateProcess或者ExitProcess才可以我的问题是
1、MessageBox函数是如何解决在消息框没有关闭的情况下而关闭了主窗口后,使整个程序都结束的?
2、ExitThread、TerminateThread为什么不可以结束一个单线程的程序呢?
PostQuitMessage(0)
PostQuitMessage(0)
PostQuitMessage(0)
这种方法也不可以,不知道为什么?MessageBox函数是如何解决在消息框没有关闭的情况下而关闭了主窗口后,使整个程序都结束的?没有人知道吗?
PostQuitMessage(0);
PostQuitMessage(0);
PostQuitMessage(0);第一个执行后,整个窗口过程立即结束了,所以后面的两个都没有机会执行了
多出二个窗口msctfime ui、ime和一个线程.我之前发贴问过,有人说是输入法,不太明白.我把不影响不大的进程全部杀死后,ExitThread、TerminateThread就没有问题了, 程序正常退出了
If the thread is the main thread in the process when this function is called, the thread's process is also terminated. If the primary thread calls the ExitThread function, the application exits.TerminateThread()
It also terminates the thread process only if the thread in question is the main or primary thread.msdn说这两个都可以结束单线程app的。。线程消息队列是不是阻塞了哦?