Click here to Skip to main content
15,913,915 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Last Thread post for me... Pin
Anonymous15-Oct-02 6:56
Anonymous15-Oct-02 6:56 
GeneralRe: Last Thread post for me... Pin
Jon Hulatt15-Oct-02 6:42
Jon Hulatt15-Oct-02 6:42 
GeneralRe: Last Thread post for me... Pin
Anonymous15-Oct-02 7:02
Anonymous15-Oct-02 7:02 
GeneralRe: Last Thread post for me... Pin
Jon Hulatt15-Oct-02 21:24
Jon Hulatt15-Oct-02 21:24 
GeneralHere's the memory dump, if it helps.. Pin
Anonymous15-Oct-02 7:29
Anonymous15-Oct-02 7:29 
GeneralRe: Here's the memory dump, if it helps.. Pin
Jon Hulatt15-Oct-02 21:16
Jon Hulatt15-Oct-02 21:16 
GeneralRe: Here's the memory dump, if it helps.. Pin
jhwurmbach15-Oct-02 22:30
jhwurmbach15-Oct-02 22:30 
GeneralRe: Last Thread post for me... Pin
KaЯl16-Oct-02 0:23
KaЯl16-Oct-02 0:23 
The best way to kill a thread is asking it to finish and wait for its end. A way to to this could be to implement a specific message send by the app to the thread.
(m_pMyThread is the pointer you get from AfxBeginThread
WM_STOPTHREAD defined as WM_APP + 1)

In the application:

<code>
// asking the thread to end
m_pMyThread->PostThreadMessage(WM_STOPTHREAD, 0, 0);
MsgWaitForMultipleObjects(1, &(m_pMyThread->m_hThread), TRUE, INFINITE, QS_ALLEVENTS);</code>

In the thread

<code>BEGIN_MESSAGE_MAP(CMyThread, CWinThread)
ON_THREAD_MESSAGE(WM_STOPTHREAD, OnStopThread)
END_MESSAGE_MAP()</code>

<code>LRESULT CMyThread::OnStopThreadClip(WPARAM wParam, LPARAM lParam)
{
// cleaning data here

AfxEndThread(1);

return 0L;
}</code>

HTH,

K.

<font size=0>
Some of those that work forces
Are the same that burn crosses !

Killing In The Name/Rage Against The Machine
</a>
</font>
GeneralPrint preview and OnClose Pin
-Dy15-Oct-02 4:45
-Dy15-Oct-02 4:45 
GeneralRe: Print preview and OnClose Pin
Tomasz Sowinski15-Oct-02 4:58
Tomasz Sowinski15-Oct-02 4:58 
GeneralRe: Print preview and OnClose Pin
-Dy15-Oct-02 5:31
-Dy15-Oct-02 5:31 
GeneralSCroll bar size Pin
suresh_sathya15-Oct-02 3:30
suresh_sathya15-Oct-02 3:30 
GeneralRe: SCroll bar size Pin
Tomasz Sowinski15-Oct-02 3:41
Tomasz Sowinski15-Oct-02 3:41 
GeneralUse CRecordSet with Access Pin
MyEden15-Oct-02 2:58
MyEden15-Oct-02 2:58 
GeneralRe: Use CRecordSet with Access Pin
Tomasz Sowinski15-Oct-02 3:14
Tomasz Sowinski15-Oct-02 3:14 
GeneralRe: Use CRecordSet with Access Pin
MyEden15-Oct-02 3:14
MyEden15-Oct-02 3:14 
GeneralRe: Use CRecordSet with Access Pin
Tomasz Sowinski15-Oct-02 3:20
Tomasz Sowinski15-Oct-02 3:20 
GeneralNeed Help: MFC Date and Time Pin
leonwoo15-Oct-02 1:45
leonwoo15-Oct-02 1:45 
GeneralRe: Need Help: MFC Date and Time Pin
Tomasz Sowinski15-Oct-02 1:54
Tomasz Sowinski15-Oct-02 1:54 
GeneralMouse coordinates are too big Pin
rkwan15-Oct-02 0:14
rkwan15-Oct-02 0:14 
GeneralRe: Mouse coordinates are too big Pin
Jon Hulatt15-Oct-02 1:03
Jon Hulatt15-Oct-02 1:03 
GeneralRe: Mouse coordinates are too big Pin
rjuncu15-Oct-02 3:34
rjuncu15-Oct-02 3:34 
GeneralCList Pin
stevenson14-Oct-02 23:17
stevenson14-Oct-02 23:17 
GeneralRe: CList Pin
Alexandru Savescu14-Oct-02 23:24
Alexandru Savescu14-Oct-02 23:24 
GeneralDebug Vs Release Mode Pin
Jamil Ahme14-Oct-02 22:55
sussJamil Ahme14-Oct-02 22:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.