Click here to Skip to main content
15,914,013 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Confused: CButton's DrawItem and onclicked Pin
JohnnyG28-Jan-03 3:04
JohnnyG28-Jan-03 3:04 
GeneralRe: Confused: CButton's DrawItem and onclicked Pin
Paolo Messina28-Jan-03 3:34
professionalPaolo Messina28-Jan-03 3:34 
GeneralRe: Confused: CButton's DrawItem and onclicked Pin
JohnnyG28-Jan-03 6:52
JohnnyG28-Jan-03 6:52 
GeneralRe: Confused: CButton's DrawItem and onclicked Pin
Paolo Messina29-Jan-03 0:33
professionalPaolo Messina29-Jan-03 0:33 
GeneralC++ DLL usage in VC7 Pin
Jim Crafton27-Jan-03 7:29
Jim Crafton27-Jan-03 7:29 
GeneralRe: C++ DLL usage in VC7 Pin
Joe Woodbury27-Jan-03 7:56
professionalJoe Woodbury27-Jan-03 7:56 
GeneralRe: C++ DLL usage in VC7 Pin
Mike Nordell27-Jan-03 9:16
Mike Nordell27-Jan-03 9:16 
GeneralWorker thread + memory leak.. Pin
RobJones27-Jan-03 7:01
RobJones27-Jan-03 7:01 
Hello,
I have a console app where I spawn a worker thread to do some work Smile | :) .. I do a wait for single object.. if the object is around for 30 seconds I want to kill the worker thread. Here is my code.. note "delete pStatus" causes a memory leak. How can I kill the thread with out creating a memory leak?

CWinThread* pStatus = (CWinThread*)AfxBeginThread(ThreadStatus,
				theApp, // LPARAM
				THREAD_PRIORITY_NORMAL, // PRIORITY
				0, // STACK SIZE
				CREATE_SUSPENDED, // CREATE FLAGS
				NULL); // SECURITY ATTRIBUTES
		
				pStatus->m_bAutoDelete = TRUE;
				pStatus->ResumeThread();

// WAIT FOR THE TREAD TO FINISH OR WAIT 30 SECONDS
// THEN DELETE THE THREAD.
int nWait = WaitForSingleObject(pStatus->m_hThread, 30000);
if(nWait == WAIT_TIMEOUT)
{
	printf("Timed Out..\n");
	
	// CLEAN UP THE THREAD.
	delete pStatus;
}


Thanks,
Rob
GeneralRe: Worker thread + memory leak.. Pin
Chris Meech27-Jan-03 7:35
Chris Meech27-Jan-03 7:35 
GeneralRe: Worker thread + memory leak.. Pin
RobJones27-Jan-03 7:51
RobJones27-Jan-03 7:51 
GeneralRe: Worker thread + memory leak.. Pin
Chris Meech27-Jan-03 7:56
Chris Meech27-Jan-03 7:56 
GeneralRe: Worker thread + memory leak.. Pin
RobJones27-Jan-03 8:06
RobJones27-Jan-03 8:06 
GeneralRe: Worker thread + memory leak.. Pin
Joaquín M López Muñoz27-Jan-03 8:05
Joaquín M López Muñoz27-Jan-03 8:05 
GeneralRe: Worker thread + memory leak.. Pin
RobJones27-Jan-03 9:38
RobJones27-Jan-03 9:38 
GeneralRe: Worker thread + memory leak.. Pin
Joaquín M López Muñoz27-Jan-03 9:44
Joaquín M López Muñoz27-Jan-03 9:44 
Generalerror C2712: Cannot use __try in functions that require object unwinding Pin
Joan M27-Jan-03 6:30
professionalJoan M27-Jan-03 6:30 
GeneralRe: error C2712: Cannot use __try in functions that require object unwinding Pin
Chris Meech27-Jan-03 7:43
Chris Meech27-Jan-03 7:43 
GeneralRe: error C2712: Cannot use __try in functions that require object unwinding Pin
Joan M27-Jan-03 8:32
professionalJoan M27-Jan-03 8:32 
GeneralRe: error C2712: Cannot use __try in functions that require object unwinding Pin
Mike Nordell27-Jan-03 9:20
Mike Nordell27-Jan-03 9:20 
GeneralRe: error C2712: Cannot use __try in functions that require object unwinding Pin
Joaquín M López Muñoz27-Jan-03 9:16
Joaquín M López Muñoz27-Jan-03 9:16 
GeneralRe: error C2712: Cannot use __try in functions that require object unwinding Pin
Joan M28-Jan-03 21:12
professionalJoan M28-Jan-03 21:12 
GeneralRe: error C2712: Cannot use __try in functions that require object unwinding Pin
Joaquín M López Muñoz28-Jan-03 21:32
Joaquín M López Muñoz28-Jan-03 21:32 
GeneralRe: error C2712: Cannot use __try in functions that require object unwinding Pin
Joan M28-Jan-03 21:37
professionalJoan M28-Jan-03 21:37 
GeneralRe: error C2712: Cannot use __try in functions that require object unwinding Pin
Joan M28-Jan-03 22:33
professionalJoan M28-Jan-03 22:33 
GeneralRe: error C2712: Cannot use __try in functions that require object unwinding Pin
Joaquín M López Muñoz29-Jan-03 0:09
Joaquín M López Muñoz29-Jan-03 0:09 

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.