Click here to Skip to main content
15,894,410 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: About Thread argument Pin
Member 75496014-Dec-07 9:08
Member 75496014-Dec-07 9:08 
Generalcheck if service is available - Vista Pin
Lord_Draconis13-Dec-07 22:17
Lord_Draconis13-Dec-07 22:17 
GeneralRe: check if service is available - Vista Pin
JudyL_MD14-Dec-07 2:24
JudyL_MD14-Dec-07 2:24 
GeneralRe: check if service is available - Vista Pin
Lord_Draconis14-Dec-07 3:41
Lord_Draconis14-Dec-07 3:41 
GeneralRe: check if service is available - Vista Pin
JudyL_MD14-Dec-07 3:53
JudyL_MD14-Dec-07 3:53 
QuestionPrint Preview in Dialog Pin
Shivarudrayya H13-Dec-07 21:57
Shivarudrayya H13-Dec-07 21:57 
GeneralRe: Print Preview in Dialog Pin
Nelek13-Dec-07 22:38
protectorNelek13-Dec-07 22:38 
GeneralRe: Print Preview in Dialog Pin
Shivarudrayya H13-Dec-07 22:56
Shivarudrayya H13-Dec-07 22:56 
GeneralRe: Print Preview in Dialog Pin
Nelek13-Dec-07 23:57
protectorNelek13-Dec-07 23:57 
GeneralRe: Print Preview in Dialog Pin
santhoshv8413-Dec-07 22:39
santhoshv8413-Dec-07 22:39 
Generalc++ and ... Pin
mostafa_h13-Dec-07 21:49
mostafa_h13-Dec-07 21:49 
GeneralRe: c++ and ... Pin
Nelek13-Dec-07 22:27
protectorNelek13-Dec-07 22:27 
GeneralRe: c++ and ... Pin
mostafa_h13-Dec-07 23:15
mostafa_h13-Dec-07 23:15 
GeneralRe: c++ and ... Pin
toxcct13-Dec-07 23:40
toxcct13-Dec-07 23:40 
GeneralRe: c++ and ... [modified] Pin
Nelek14-Dec-07 0:09
protectorNelek14-Dec-07 0:09 
GeneralRe: c++ and ... Pin
toxcct14-Dec-07 0:40
toxcct14-Dec-07 0:40 
JokeRe: c++ and ... Pin
Nelek14-Dec-07 0:42
protectorNelek14-Dec-07 0:42 
GeneralRe: c++ and ... Pin
toxcct14-Dec-07 0:47
toxcct14-Dec-07 0:47 
GeneralRe: c++ and ... Pin
mostafa_h14-Dec-07 5:18
mostafa_h14-Dec-07 5:18 
QuestionHow to end a thread Pin
Chen-XuNuo13-Dec-07 19:07
Chen-XuNuo13-Dec-07 19:07 
AnswerRe: How to end a thread Pin
Llasus13-Dec-07 19:21
Llasus13-Dec-07 19:21 
GeneralRe: How to end a thread Pin
Chen-XuNuo14-Dec-07 4:32
Chen-XuNuo14-Dec-07 4:32 
AnswerRe: How to end a thread Pin
Mark Salsbery13-Dec-07 19:23
Mark Salsbery13-Dec-07 19:23 
You need to synchronize the shutdown a bit better.

By the time you set m_bCanGo=FALSE you've destroyed the window,
yet your thread is still doing (attempting) operations on it.

Try something like this:
BOOL CBullet::GoDown()
{
    if((m_ptPosition.y+m_rtThis.Height())>m_rtParent.bottom)
    {
        m_ptPosition.y+=2;
        m_bCanGo=TRUE;
        return TRUE;
    }
    else
    {
<code>        m_bCanGo=FALSE;
        ::WaitForSingleObject(m_pThread, INFINITE);
</code>
        this->DestroyWindow();
        m_bCreated=FALSE;
        return FALSE;
    }
}

Mark Salsbery
Microsoft MVP - Visual C++

Java | [Coffee]

GeneralRe: How to end a thread Pin
Chen-XuNuo14-Dec-07 4:34
Chen-XuNuo14-Dec-07 4:34 
GeneralRe: How to end a thread Pin
Mark Salsbery14-Dec-07 4:58
Mark Salsbery14-Dec-07 4:58 

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.