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

C / C++ / MFC

 
AnswerRe: Errorlevel Pin
Paul Conrad2-Feb-07 19:08
professionalPaul Conrad2-Feb-07 19:08 
AnswerRe: Errorlevel Pin
Mark Salsbery2-Feb-07 19:12
Mark Salsbery2-Feb-07 19:12 
AnswerRe: Errorlevel Pin
Michael Dunn2-Feb-07 19:46
sitebuilderMichael Dunn2-Feb-07 19:46 
QuestionStrange error: -1#IND0 Pin
Anthony Mushrow2-Feb-07 15:29
professionalAnthony Mushrow2-Feb-07 15:29 
AnswerRe: Strange error: -1#IND0 Pin
Anthony Mushrow2-Feb-07 16:09
professionalAnthony Mushrow2-Feb-07 16:09 
QuestionLoad DLL resource which contain custom control Pin
dungpapai2-Feb-07 14:47
dungpapai2-Feb-07 14:47 
AnswerRe: Load DLL resource which contain custom control Pin
Atul232-Feb-07 18:45
Atul232-Feb-07 18:45 
QuestionTerminating a thread Pin
BuckBrown2-Feb-07 11:00
BuckBrown2-Feb-07 11:00 
I am using Visual C++ 6.0 MFC. I have gotten my secondary thread to work using AfxBeginThread(TestThread, this); but I don't want to use TerminateThread() based upon what I have been reading. When the secondary thread is spawned it may take 20 minutes for it to complete. I have a button on the tab page that spawned the thread that I want to use to 'Cancel Test' but I am confused as how to go about telling the thread to terminate itself cleanly. The psuedo code is as follows -

UINT C65602::TestThread(LPVOID Param)
{
C65602* device_type = (C65602*)Param;
device_type->TestThread();
return 0;
}

void C65602::TestThread()
{
HRESULT hr = CoInitialize(NULL);
pTests->pOutput->OpenExcelWorksheet();
pTests->RunTest(); // This may take 20 minutes
CoUninitialize();
AfxEndThread(0, TRUE);
}

void C65602::OnButtonBeginTest()
{
AfxBeginThread(TestThread, this);
}

void C65602::OnButtonCancelTest()
{
// I beleive this is where I want to tell the thread to terminate itself.

pTests->pGPIB->TurnOffDevice();
pTests->pOutput->SaveAndQuitExcel();

// or does it need to be here because of the Excel Automation im using?

AfxMessageBox("Test Canceled", MB_ICONINFORMATION);

CTabPage::OnCancel();
}

If anyone can push me in the right direction, throw me off the cliff.

Buck


AnswerRe: Terminating a thread Pin
Ravi Bhavnani2-Feb-07 11:31
professionalRavi Bhavnani2-Feb-07 11:31 
GeneralRe: Terminating a thread Pin
BuckBrown2-Feb-07 13:09
BuckBrown2-Feb-07 13:09 
AnswerRe: Terminating a thread Pin
Garth J Lancaster2-Feb-07 11:52
professionalGarth J Lancaster2-Feb-07 11:52 
GeneralRe: Terminating a thread Pin
BuckBrown2-Feb-07 13:09
BuckBrown2-Feb-07 13:09 
AnswerRe: Terminating a thread Pin
Mark Salsbery2-Feb-07 13:23
Mark Salsbery2-Feb-07 13:23 
AnswerRe: Terminating a thread Pin
Stephen Hewitt4-Feb-07 12:30
Stephen Hewitt4-Feb-07 12:30 
QuestionPointer to Document Pin
DanYELL2-Feb-07 8:24
DanYELL2-Feb-07 8:24 
AnswerRe: Pointer to Document Pin
Mark Salsbery2-Feb-07 8:38
Mark Salsbery2-Feb-07 8:38 
AnswerRe: Pointer to Document Pin
led mike2-Feb-07 8:44
led mike2-Feb-07 8:44 
AnswerRe: Pointer to Document Pin
David Crow2-Feb-07 9:30
David Crow2-Feb-07 9:30 
QuestionCMyDocument::Serialize(CArchive& ar) is not called Pin
lucy2-Feb-07 8:01
lucy2-Feb-07 8:01 
AnswerRe: CMyDocument::Serialize(CArchive& ar) is not called Pin
led mike2-Feb-07 11:10
led mike2-Feb-07 11:10 
GeneralRe: CMyDocument::Serialize(CArchive& ar) is not called Pin
lucy3-Feb-07 16:51
lucy3-Feb-07 16:51 
GeneralRe: CMyDocument::Serialize(CArchive& ar) is not called Pin
led mike5-Feb-07 6:07
led mike5-Feb-07 6:07 
GeneralRe: CMyDocument::Serialize(CArchive& ar) is not called Pin
lucy5-Feb-07 8:28
lucy5-Feb-07 8:28 
QuestionLinking with NcFreeNetconProperties Pin
werpa2-Feb-07 7:58
werpa2-Feb-07 7:58 
AnswerRe: Linking with NcFreeNetconProperties Pin
Mark Salsbery2-Feb-07 8:45
Mark Salsbery2-Feb-07 8:45 

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.