Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

debug assertion error dbgheap.c
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)





here is my code.

// DEFINE VAIRABLES
CString DataStream;
int DataArray[11];
int iCounter;
string sBuffer;
int pos;
bool bDone;
int m_count;
int nStrPos;
int nLength;
int d = 0;
CString MonitorCaption;
bool GetMoreData = true;

// initial log events variable
if (LogInformation == "TRUE")
{
LogEvents = 0;
}
else
{
LogEvents = -1;
}

// set up interface pointer
CPDSInterface* PDSInterface;

if (PDSInterface != NULL)
{
PDSInterface = NULL;
}

// initialize variables for process
DWORD Error = 0;

if (PDSInterface != NULL)
{
PDSInterface = NULL;
}

PDSInterface = new CPDSInterface();

// establishe iniital connect
d = PDSInterface->Initialize("127.0.0.1");

if (d != SUCCESS)
{
if (LogEvents == 0)
{
CString strMessage("Failured to initialize Monitor");
ErrorLog(strMessage);
}
return;
}

// need to open a connection to the gateway first..
d = PDSInterface->Connect("196.76.0.1");

if (d != SUCCESS)
{
if (LogEvents == 0)
{
CString strMessage("Failured to Connect to Monitor");
ErrorLog(strMessage);
}
return;
}

// clear the buffers
d = PDSInterface->ClearData("196.76.0.1");

if (d != SUCCESS)
{
if (LogEvents == 0)
{
CString strMessage("Failured to clear the buffer of Monitor");
ErrorLog(strMessage);
}
return;
}

// udpdate caption of button
MonitorCaption = m_Caption;
COleControl::SetText(MonitorCaption);
 COleControl::RedrawWindow(0,0,RDW_UPDATE
NOW);

// main loop
try
{
while (GetMoreData)
{
Sleep(1000);
DoEvents();

if (LogEvents == 0)
{
CString strMessage("before datastream");
ErrorLog(strMessage);
}

if (PDSInterface == NULL)
{
CString strMessage("PDSInterface is NULL.");
CString strTitle("TITLE");
MessageBox(strMessage, strTitle, MB_OK);
}

// get data from monitor
d = PDSInterface->GetData("196.76.0.1", DataStream);

if (LogEvents == 0)
{
CString strMessage(DataStream);
ErrorLog(strMessage);
}

if (DataStream == "")
{
CString strMessage("DataStream is NULL");
ErrorLog(strMessage);
}

Sleep(1000);
DoEvents();

if ((d == SUCCESS) && (DataStream != ""))
{

// reset variables
m_count = 0;
pos = 0;
iCounter = 0;
bDone = false;

// convert cstring to string, to be able to work with the string
properties
CT2CA pszConvertedAnsiString (DataStream);
string sWorkString (pszConvertedAnsiString);

// parse data steam into data array
pos = sWorkString.find(' ');

if (LogEvents == 0)
{
CString strMessage("Before Parsing");
ErrorLog(strMessage);
}

if (pos >= 0)
{
nLength = sWorkString.size();
// we have work to do,and we have to do it one character at a time
sBuffer     = "";
nStrPos = 0;

do
{
char cCharToAdd = sWorkString.at(nStrPos);

if (cCharToAdd != ' ')
{
//add the character
sBuffer += cCharToAdd;
nStrPos++;
}
else
{
if (sBuffer == "-32767")
{
DataArray[iCounter] = 0;
}
else
{
DataArray[iCounter] = atoi(sBuffer.c_str());
}
iCounter++;
nStrPos++;
sBuffer = "";
}

if (nStrPos >= nLength)
{
bDone = true;

}
} while (!bDone);
}

if (LogEvents == 0)
{
CString strMessage("After Parsing");
ErrorLog(strMessage);
}

// move data to variables
int Systolic = DataArray[1];
int Diastolic = DataArray[2];
int ETCO2 = DataArray[5];
int PulseRate = DataArray[6];
int RespirationRate = DataArray[8];
int SPO2 = DataArray[10];

// Update Web Page
UpdateWebPage(PulseRate, Systolic, Diastolic, SPO2, RespirationRate);
DoEvents();

if (LogEvents == 0)
{
CString strMessage("after web update");
ErrorLog(strMessage);
}

Sleep(1000);
DoEvents();


// write to log
 WriteToLog(PulseRate,Systolic,Diastolic,
SPO2,RespirationRate);
DoEvents();
}
if (LogEvents == 0)
{
CString strMessage("before returning to top");
ErrorLog(strMessage);
}
}
}

// catch all errors
catch(...)
{
GetMoreData = false;
}
return;

please help,

Report this thread to moderator Post Follow-up to this message
Old Post
DLueck
04-17-08 12:37 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

VC++ archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 10:44 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.