Click here to Skip to main content
15,903,175 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Windows Shutdown [modified] Pin
NeoAks00714-Mar-09 10:10
NeoAks00714-Mar-09 10:10 
GeneralRe: Windows Shutdown [modified] Pin
hxhl9514-Mar-09 12:08
hxhl9514-Mar-09 12:08 
Question[Message Deleted] Pin
mini_25068914-Mar-09 7:56
mini_25068914-Mar-09 7:56 
AnswerRe: help me!!!!!!!! Pin
Stuart Dootson14-Mar-09 8:00
professionalStuart Dootson14-Mar-09 8:00 
GeneralRe: help me!!!!!!!! Pin
NeoAks00714-Mar-09 8:04
NeoAks00714-Mar-09 8:04 
AnswerRe: help me!!!!!!!! Pin
NeoAks00714-Mar-09 8:02
NeoAks00714-Mar-09 8:02 
QuestionHow to delete handles of a thread created with AfxBeginThread Pin
keret14-Mar-09 7:29
keret14-Mar-09 7:29 
AnswerRe: How to delete handles of a thread created with AfxBeginThread Pin
Stuart Dootson14-Mar-09 7:58
professionalStuart Dootson14-Mar-09 7:58 
1. Why not take a local copy of *pInfo early in the thread function, so you can delete pInfo early:

UINT ThreadFunction(LPVOID pParam)
{
    ThreadInfo info(reinterpret_cast<ThreadInfo*>(pParam));
    delete reinterpret_cast<ThreadInfo*>(pParam);
 
    while (IsWindow(info.hMonitoredWindow))
    {
      
       do.Something;
       Sleep(100);
       
    }
    return 0;
}


2. Do you keep track of all the threads you've created? Doesn't look like it. Store them in a vector or something and delete them in your dialog's WM_CLOSE handler.

3. If the monitored windows aren't closed, does the thread terminate? You probably ought to have some way of telling the threads to exit even if their monitored window still exists.

Basically, you need to think about the likely lifetimes of objects and work out where you need to be deleting objects.

Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

GeneralRe: How to delete handles of a thread created with AfxBeginThread Pin
keret14-Mar-09 9:51
keret14-Mar-09 9:51 
GeneralRe: How to delete handles of a thread created with AfxBeginThread Pin
Stuart Dootson14-Mar-09 10:36
professionalStuart Dootson14-Mar-09 10:36 
GeneralRe: How to delete handles of a thread created with AfxBeginThread Pin
keret14-Mar-09 11:17
keret14-Mar-09 11:17 
GeneralRe: How to delete handles of a thread created with AfxBeginThread Pin
Stuart Dootson14-Mar-09 11:52
professionalStuart Dootson14-Mar-09 11:52 
GeneralRe: How to delete handles of a thread created with AfxBeginThread Pin
keret15-Mar-09 4:03
keret15-Mar-09 4:03 
GeneralRe: How to delete handles of a thread created with AfxBeginThread Pin
Stuart Dootson15-Mar-09 6:07
professionalStuart Dootson15-Mar-09 6:07 
GeneralRe: How to delete handles of a thread created with AfxBeginThread Pin
keret15-Mar-09 9:55
keret15-Mar-09 9:55 
QuestionTemplate Class Issues in C++. Pin
NeoAks00714-Mar-09 7:24
NeoAks00714-Mar-09 7:24 
AnswerRe: Template Class issues in C++. Pin
N a v a n e e t h14-Mar-09 7:31
N a v a n e e t h14-Mar-09 7:31 
GeneralRe: Template Class issues in C++. Pin
NeoAks00714-Mar-09 7:38
NeoAks00714-Mar-09 7:38 
GeneralRe: Template Class issues in C++. Pin
N a v a n e e t h14-Mar-09 7:45
N a v a n e e t h14-Mar-09 7:45 
QuestionRe: Template Class issues in C++. Pin
NeoAks00714-Mar-09 7:50
NeoAks00714-Mar-09 7:50 
AnswerRe: Template Class issues in C++. Pin
Stuart Dootson14-Mar-09 8:07
professionalStuart Dootson14-Mar-09 8:07 
AnswerRe: Template Class issues in C++. Pin
N a v a n e e t h14-Mar-09 8:14
N a v a n e e t h14-Mar-09 8:14 
QuestionRe: Template Class issues in C++. Pin
NeoAks00714-Mar-09 8:32
NeoAks00714-Mar-09 8:32 
NewsRe: Template Class issues in C++. Pin
NeoAks00714-Mar-09 9:16
NeoAks00714-Mar-09 9:16 
AnswerRe: Template Class issues in C++. Pin
Stuart Dootson14-Mar-09 9:38
professionalStuart Dootson14-Mar-09 9:38 

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.