Click here to Skip to main content
15,850,359 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionProblem in capturing the enter event of an edit control. Pin
chandu0041-Dec-07 1:50
chandu0041-Dec-07 1:50 
AnswerRe: Problem in capturing the enter event of an edit control. Pin
Jijo.Raj2-Dec-07 1:59
Jijo.Raj2-Dec-07 1:59 
QuestionNo CPen? Pin
Haakon S.1-Dec-07 1:29
Haakon S.1-Dec-07 1:29 
AnswerRe: No CPen? Pin
CPallini1-Dec-07 1:44
mveCPallini1-Dec-07 1:44 
GeneralRe: No CPen? Pin
Haakon S.1-Dec-07 1:56
Haakon S.1-Dec-07 1:56 
GeneralRe: No CPen? Pin
Haakon S.1-Dec-07 2:38
Haakon S.1-Dec-07 2:38 
QuestionThreads Pin
krishna Vuppala1-Dec-07 0:30
krishna Vuppala1-Dec-07 0:30 
AnswerRe: Threads Pin
CPallini1-Dec-07 1:00
mveCPallini1-Dec-07 1:00 
krishna Vuppala wrote:
How to use TerminateThread() function in program.
iam used like this but the thread is not stopped.


Thread is not stopped because you're doing a mistake on passing the first argument to TerminateThread function. It must be the thread HANDLE and not the pointer to che CWinThread class.
Hence you have to use:
TerminateThread(m_pNuThread->m_hThread, 0);


BTW: as stated by the documentation you should avoid to use TerminateThread (it must be only the last resort), there are other ways to stop smoothly a thread, for instance setting and (added) flag in your thread loop control condition, i.e.:
UINT NuThread(LPVOID lParam)
{ 
  //...
  for(int i=0; i <= 100 && bKeepRunning;i++)
  //..
}


Hence you can simply set bKeepRunning=false outside the thread to gracefully stop it.

Hope that helps.
Smile | :)




If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.

GeneralRe: Threads Pin
krishna Vuppala1-Dec-07 1:46
krishna Vuppala1-Dec-07 1:46 
GeneralRe: Threads Pin
CPallini1-Dec-07 7:55
mveCPallini1-Dec-07 7:55 
GeneralRe: Threads Pin
Hamid_RT1-Dec-07 9:08
Hamid_RT1-Dec-07 9:08 
Questionabout unary_function Pin
George_George30-Nov-07 23:52
George_George30-Nov-07 23:52 
AnswerRe: about unary_function Pin
CPallini1-Dec-07 1:43
mveCPallini1-Dec-07 1:43 
Questioni have some question about binary stream file. Pin
buffering8330-Nov-07 23:07
buffering8330-Nov-07 23:07 
QuestionRe: i have some question about binary stream file. Pin
CPallini1-Dec-07 0:41
mveCPallini1-Dec-07 0:41 
AnswerRe: i have some question about binary stream file. Pin
buffering831-Dec-07 1:53
buffering831-Dec-07 1:53 
GeneralRe: i have some question about binary stream file. Pin
CPallini1-Dec-07 3:53
mveCPallini1-Dec-07 3:53 
GeneralRe: i have some question about binary stream file. Pin
buffering831-Dec-07 4:02
buffering831-Dec-07 4:02 
GeneralRe: i have some question about binary stream file. Pin
CPallini1-Dec-07 7:47
mveCPallini1-Dec-07 7:47 
GeneralRe: i have some question about binary stream file. Pin
buffering831-Dec-07 17:23
buffering831-Dec-07 17:23 
Questiontech to dock a CListCtrl in the client area of SDI mainframe Pin
followait30-Nov-07 20:15
followait30-Nov-07 20:15 
QuestionRe: tech to dock a CListCtrl in the client area of SDI mainframe Pin
bob169721-Dec-07 15:17
bob169721-Dec-07 15:17 
AnswerRe: tech to dock a CListCtrl in the client area of SDI mainframe Pin
followait1-Dec-07 15:44
followait1-Dec-07 15:44 
Questionhow can i open a file and search a specific name on it Pin
maryam_s30-Nov-07 20:05
maryam_s30-Nov-07 20:05 
AnswerRe: how can i open a file and search a specific name on it Pin
Hamid_RT30-Nov-07 20:11
Hamid_RT30-Nov-07 20:11 

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.