By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,804 Members | 1,631 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,804 IT Pros & Developers. It's quick & easy.

debug assertion error in threads of c++ under windows

P: n/a
Hi All,

This my part of the c++ program using threads in windows :

//modified by pushpa
struct structExrdDoc
{
CExrdDoc* spDoc;
LPCTSTR sstrFileName;

structExrdDoc():spDoc(NULL),sstrFileName(""){}
};
structExrdDoc sp;

volatile bool running;

UINT CExcelExport::run(LPVOID p)
{
CExrdDoc* me = sp.spDoc;
me->OnSaveDocument ((LPCTSTR)sp.sstrFileName);
running = FALSE;
return 0;
}
//modified by pushpa

void CExcelExport::SaveExcelFile (CExrdDoc* pDoc, const string&
strFileName)
{
sp.spDoc = pDoc; //modified by pushpa
sp.sstrFileName = strFileName.c_str(); //modified by pushpa
running = TRUE; //modified by pushpa
AfxBeginThread(run,NULL); //modified by pushpa
//pDoc->OnSaveDocument (strFileName.c_str()); //modified by pushpa
}
Here the line of code I have commented was taking lot of time, so I hv
tried to use
threads and I am new to this.

This is the declaration in the .h file

static UINT CExcelExport::run(LPVOID p);

After some struggle I could compile the application, but when it is
run I am getting a
Debug assertion error.

debug assertion failed!
program:d:\amsa\amsa\bin\gageanalysisdlld.exe
file:wincore.cpp
line:888
for information on how your program can cause an assertion failure,
see the visual c++

documentation on asserts.

Could you please help me with this.

Thanking you in advance,
Pushpa.

Mar 9 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Mar 9, 6:13 pm, "Pushpa" <pushpade...@gmail.comwrote:
Hi All,

This my part of the c++ program using threads in windows :

//modified by pushpa
struct structExrdDoc
{
CExrdDoc* spDoc;
LPCTSTR sstrFileName;

structExrdDoc():spDoc(NULL),sstrFileName(""){}};

structExrdDoc sp;

volatile bool running;

UINT CExcelExport::run(LPVOID p)
{
CExrdDoc* me = sp.spDoc;
me->OnSaveDocument ((LPCTSTR)sp.sstrFileName);
running = FALSE;
return 0;}

//modified by pushpa

void CExcelExport::SaveExcelFile (CExrdDoc* pDoc, const string&
strFileName)
{
sp.spDoc = pDoc; //modified by pushpa
sp.sstrFileName = strFileName.c_str(); //modified by pushpa
running = TRUE; //modified by pushpa
AfxBeginThread(run,NULL); //modified by pushpa
//pDoc->OnSaveDocument (strFileName.c_str()); //modified by pushpa

}

Here the line of code I have commented was taking lot of time, so I hv
tried to use
threads and I am new to this.

This is the declaration in the .h file

static UINT CExcelExport::run(LPVOID p);

After some struggle I could compile the application, but when it is
run I am getting a
Debug assertion error.

debug assertion failed!
program:d:\amsa\amsa\bin\gageanalysisdlld.exe
file:wincore.cpp
line:888
for information on how your program can cause an assertion failure,
see the visual c++

documentation on asserts.

Could you please help me with this.

Thanking you in advance,
Pushpa.
First of all if, possible remove the duplicate posts.

CExrdDoc* me = sp.spDoc;
me->OnSaveDocument ((LPCTSTR)sp.sstrFileName);

I really dint get how you assigned sp

Your code is not complete and run it in the debug mode. when the
program crashes, just break there and check the call stack. From there
you can identify which part of your code caused the problem.

Mar 9 '07 #2

P: n/a
On Mar 9, 6:13 pm, "Pushpa" <pushpade...@gmail.comwrote:
Hi All,

This my part of the c++ program using threads in windows :

//modified by pushpa
struct structExrdDoc
{
CExrdDoc* spDoc;
LPCTSTR sstrFileName;

structExrdDoc():spDoc(NULL),sstrFileName(""){}};

structExrdDoc sp;

volatile bool running;

UINT CExcelExport::run(LPVOID p)
{
CExrdDoc* me = sp.spDoc;
me->OnSaveDocument ((LPCTSTR)sp.sstrFileName);
running = FALSE;
return 0;}

//modified by pushpa

void CExcelExport::SaveExcelFile (CExrdDoc* pDoc, const string&
strFileName)
{
sp.spDoc = pDoc; //modified by pushpa
sp.sstrFileName = strFileName.c_str(); //modified by pushpa
running = TRUE; //modified by pushpa
AfxBeginThread(run,NULL); //modified by pushpa
//pDoc->OnSaveDocument (strFileName.c_str()); //modified by pushpa

}

Here the line of code I have commented was taking lot of time, so I hv
tried to use
threads and I am new to this.

This is the declaration in the .h file

static UINT CExcelExport::run(LPVOID p);

After some struggle I could compile the application, but when it is
run I am getting a
Debug assertion error.

debug assertion failed!
program:d:\amsa\amsa\bin\gageanalysisdlld.exe
file:wincore.cpp
line:888
for information on how your program can cause an assertion failure,
see the visual c++

documentation on asserts.

Could you please help me with this.

Thanking you in advance,
Pushpa.
Your code is not complete and run it in the debug mode. when the
program crashes, just break there and check the call stack. From there
you can identify which part of your code caused the problem.

Mar 9 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.