Canada Bass
April 22nd, 1999, 08:44 PM
Hello all, I am trying to close an MFC app after I have met a certain condition. In a thread I have created, I use:
m_pOwner->PostMessage(WM_CLOSE, 0, 0L);
m_pOwner is a pointer to my AppDlg.
I have looked at the example Mutexes(on the VC++ cd) and it does this also. I have tried to create an application that is very close to what Mutexes does. However, if I do this my program crashes when I run it. I have two threads running. If I comment out the first thread(so that it doesn't run) this command works fine, but once I uncomment the lines the second thread generates an error. It may be that I have to use CSingleLock in both threads, I do use it in the second thread. Any help would be appreciated. Thanks!
m_pOwner->PostMessage(WM_CLOSE, 0, 0L);
m_pOwner is a pointer to my AppDlg.
I have looked at the example Mutexes(on the VC++ cd) and it does this also. I have tried to create an application that is very close to what Mutexes does. However, if I do this my program crashes when I run it. I have two threads running. If I comment out the first thread(so that it doesn't run) this command works fine, but once I uncomment the lines the second thread generates an error. It may be that I have to use CSingleLock in both threads, I do use it in the second thread. Any help would be appreciated. Thanks!