473,657 Members | 2,439 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

debug assertion error in threads of c++ under windows

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),ss trFileName(""){ }
};
structExrdDoc sp;

volatile bool running;

UINT CExcelExport::r un(LPVOID p)
{
CExrdDoc* me = sp.spDoc;
me->OnSaveDocume nt ((LPCTSTR)sp.ss trFileName);
running = FALSE;
return 0;
}
//modified by pushpa

void CExcelExport::S aveExcelFile (CExrdDoc* pDoc, const string&
strFileName)
{
sp.spDoc = pDoc; //modified by pushpa
sp.sstrFileName = strFileName.c_s tr(); //modified by pushpa
running = TRUE; //modified by pushpa
AfxBeginThread( run,NULL); //modified by pushpa
//pDoc->OnSaveDocume nt (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::r un(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\gagea nalysisdlld.exe
file:wincore.cp p
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
2 5563
On Mar 9, 6:13 pm, "Pushpa" <pushpade...@gm ail.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),ss trFileName(""){ }};

structExrdDoc sp;

volatile bool running;

UINT CExcelExport::r un(LPVOID p)
{
CExrdDoc* me = sp.spDoc;
me->OnSaveDocume nt ((LPCTSTR)sp.ss trFileName);
running = FALSE;
return 0;}

//modified by pushpa

void CExcelExport::S aveExcelFile (CExrdDoc* pDoc, const string&
strFileName)
{
sp.spDoc = pDoc; //modified by pushpa
sp.sstrFileName = strFileName.c_s tr(); //modified by pushpa
running = TRUE; //modified by pushpa
AfxBeginThread( run,NULL); //modified by pushpa
//pDoc->OnSaveDocume nt (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::r un(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\gagea nalysisdlld.exe
file:wincore.cp p
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->OnSaveDocume nt ((LPCTSTR)sp.ss trFileName);

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
On Mar 9, 6:13 pm, "Pushpa" <pushpade...@gm ail.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),ss trFileName(""){ }};

structExrdDoc sp;

volatile bool running;

UINT CExcelExport::r un(LPVOID p)
{
CExrdDoc* me = sp.spDoc;
me->OnSaveDocume nt ((LPCTSTR)sp.ss trFileName);
running = FALSE;
return 0;}

//modified by pushpa

void CExcelExport::S aveExcelFile (CExrdDoc* pDoc, const string&
strFileName)
{
sp.spDoc = pDoc; //modified by pushpa
sp.sstrFileName = strFileName.c_s tr(); //modified by pushpa
running = TRUE; //modified by pushpa
AfxBeginThread( run,NULL); //modified by pushpa
//pDoc->OnSaveDocume nt (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::r un(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\gagea nalysisdlld.exe
file:wincore.cp p
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2020
by: Chemix | last post by:
Hello people, I've developed a windows forms application with VC++.NET. The problem I have is the next: I run my application and all seems go OK, but passed a certain time (it can be hours or some minutes), then a dialog window opens with the title:Microsoft Visual C++ Debug Library, and the next error: Debug Assertion Failed! Program: name of my program File: dbgheap.c Line: 1132 Expression: _CrtIsValidHeadPointer(pUserData)
6
595
by: Cormac | last post by:
Hi everyone, I'm writing Pure Data externals in C++ using Ms Visual C++ 7.0 and Windows2000. I'm running motions sensor hardware so there's a bit of real time data processing involved. When I'm running my objects in Pure Data, I get an assertion failure after a few seconds of running the motion sensors and I can't seem to get rid of it. The error occurs in the expression _CrtCheckMemory(). Could anyone provide some possible solutions?
2
17602
by: Arti Potnis | last post by:
Hi, I have an application with a function "myfunction" that opens a file and writes to it using fprintf. This application runs on a unix (sun solaris 5.8) system. I connect to this application from a VB GUi on a windows 2000 system. The GUI invokes "myfunction". I get the following error:-
0
2938
by: lawrence | last post by:
Hi, I made a MFC ActiveX with a CwinThread Class in VC ++. Then i used it on Visual basic. When i try to make an exe i got this error : Debug Assertion Failed! Program: C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\VB98\VB6.EXE File: cmdtarg.cpp Line: 52
7
1406
by: Seko | last post by:
Hi! This is my first post here, so please excuse me for any mistakes I make. --------------------- I'm having a hard time displaying modal/non-modal dialog boxes in a Windows Forms Application project, because of the following problem: If building a project in debug mode, I get a Debug Assertion when doing a
4
9401
by: Mullai | last post by:
Hi , My program gives an error message like this Debug Assertion Failed! program:................ File: wincore.cpp Line: 958 Please can anyone help me out in this issue. I have to solve this bug immediately in my project.
0
326
by: Pushpa | last post by:
Hi All, This my part of the c++ program using threads in windows : //modified by pushpa struct structExrdDoc { CExrdDoc* spDoc; LPCTSTR sstrFileName;
1
4158
by: themadme | last post by:
im running code thats using threads, everytime i get this debug assertion failed box poping up. It involves with my stl vector. its saying that vector iterators incompatible. the vector contains structs of data. i have ten threads running, using the same function called "GetMemory()". the function just looks through the function and swaps around the data in the vector list. The first ten containers in the vector are the Main...
0
1861
by: =?Utf-8?B?REx1ZWNr?= | last post by:
I am getting a debug assertion error that reads: Debug Assertion Failed! program E:\program files\internet explorer\iexplore,exe File: dbgheap.c Line: 1252 Expression: _CrtIsValidHeapPointer(pUserData)
0
8402
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8315
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8829
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8734
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8508
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8608
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5633
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
1962
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1627
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.