473,387 Members | 1,486 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Application crashes with a Windows XP error dialog

HI All,
I have created a MFC exe using VC++ .NET 2003 on Windows XP Prof
service pack 2 and it works properly on my machine, but when I run the
same exe on a different machine (Windows XP Prof SP-2), The application
is bought up and after some time its throwing a windows xp error dialog

box saying,
I am also running the same application on 2 more machines there
everything works fine.
Here is thr Windows XP error dialog box that appreas when its crashed
TODO: <File descriptionhas encountered a problem and needs to close.
We are sorry for any inconenience.
If you are in the middle of something, the information you were working

on might be lost.
Please tell Microsoft about this problem.
blab blah....
I have function called OnNotifyNewData (WPARAM wParam, LPARAM lParam)
which appreas to be cauing the problem. When I run the application
commenting this function its didnt crashed.
LRESULT CUserViewFrame::OnNotifyNewData (WPARAM wParam, LPARAM lParam)
{
const char* strVariable("CUserViewFrame::OnNotifyNewData START");
const char* strValue("6");
CUtility::LogDebugInfo( strVariable, strValue);
WRITE_LOG_FUNCTION_ENTRY("LRESULT CUserViewFrame::OnNotifyNewData
(WPARAM wParam, LPARAM lParam)")
PInstData pInstData = (PInstData)wParam;
if (!pInstData) return 0;
CString csText;
char buffer[255];
LVFINDINFO info;
int iIndex = 0;
PSystemSetting pSystemSetting = CSystemSetting::GetObject();
info.flags = LVFI_WRAP|LVFI_STRING;
std::vector<CMarketData>::const_iterator iter;
std::vector<CParticipant>::const_iterator iterpart;
const std::vector<CMarketData& userListBid =
pInstData->GetMarketDataBid();
for (iter = userListBid.begin(); iter != userListBid.end(); iter++)
{
const std::vector<CParticipant& participants =
iter->GetParticipants();
for (iterpart = participants.begin(); iterpart !=
participants.end();
iterpart++)
{
if (iterpart->GetSize() 0.0 && iter->GetPrice()
0.0)
{
memset(&buffer, 0, sizeof(buffer));
if (sizeof(iterpart->GetUserName()/*.c_str()*/) 255
continue;
//sprintf(buffer, "%s",
iterpart->GetUserName()/*.c_str()*/);
info.psz = iterpart->GetUserName();
iIndex = m_ctrlUserListCtrl.FindItem(&info);
if (iIndex == -1)
{ // insert the item
iIndex = m_ctrlUserListCtrl.GetItemCount();
if (sizeof(iterpart->GetUserName()/*.c_str()*/)
255
continue;
//csText.Format(TEXT("%s"),
iterpart->GetUserName()/*.c_str()
csText = iterpart->GetUserName(); //Sanjeev
012407
int size = iterpart->GetUserName().GetLength();

char bufsize[20];
memset(&bufsize, 0, sizeof(bufsize));
_itoa(size,bufsize,10);
CUtility::LogDebugInfo( "OnNotifyNewData - BID
UserName", bufsize);

m_ctrlUserListCtrl.InsertItem(LVIF_TEXT|LVIF_STATE , iIndex, csText,
0,
LVIS_SELECTED, 0, 0);
char * pchText = new char [csText.GetLength() +
1];
strcpy(pchText, (LPCTSTR)csText);
m_ctrlUserListCtrl.SetItemData(iIndex,
(DWORD)pchText);
}
if
(sizeof(pInstData->GetInstName()/*.c_str()*/) 255)
continue;
//csText.Format(TEXT("%s"),
pInstData->GetInstName()/*.c_str()*/);
csText =
pInstData->GetInstName();
m_ctrlUserListCtrl.SetItemText(iIndex,
eUserViewListColumn::BID_INST, csText);
memset(&buffer, 0, sizeof(buffer));
sprintf(buffer, "%%.%df",
pSystemSetting->GetDecimalSize());
csText.Format(buffer, iterpart->GetSize());
m_ctrlUserListCtrl.SetItemText(iIndex,
eUserViewListColumn::BID_SIZE, csText);
memset(&buffer, 0, sizeof(buffer));
sprintf(buffer, "%%.%df",
pSystemSetting->GetDecimalPrice());
csText.Format(buffer, iter->GetPrice());
m_ctrlUserListCtrl.SetItemText(iIndex,
eUserViewListColumn::BID_PRICE, csText);
if (sizeof(iterpart->GetTimestamp().c_str()) >
255)
continue;
csText.Format("%s",
iterpart->GetTimestamp().c_str());
m_ctrlUserListCtrl.SetItemText(iIndex,
eUserViewListColumn::BID_TIME, csText);
}
}
}
const std::vector<CMarketData& userListAsk =
pInstData->GetMarketDataAsk();
for (iter = userListAsk.begin(); iter != userListAsk.end();
iter++)
{
const std::vector<CParticipant& participants =
iter->GetParticipants();
for (iterpart = participants.begin(); iterpart !=
participants.end();
iterpart++)
{
if (iterpart->GetSize() 0.0 &&
iter->GetPrice() 0.0)
{
memset(&buffer, 0, sizeof(buffer));
if (sizeof(iterpart->GetUserName()/*.c_str()*/)
255)
continue;
//sprintf(buffer, "%s",
iterpart->GetUserName()/*.c_str()*/);
int size = iterpart->GetUserName().GetLength();

char bufsize[20];
memset(&bufsize, 0, sizeof(bufsize));
_itoa(size,bufsize,10);
CUtility::LogDebugInfo( "OnNotifyNewData - ASK
UserName", bufsize);
info.psz = iterpart->GetUserName();
iIndex = m_ctrlUserListCtrl.FindItem(&info);
if (iIndex == -1)
{ // insert the item
iIndex = m_ctrlUserListCtrl.GetItemCount();
if (sizeof(iterpart->GetUserName()/*.c_str()*/)
255)
continue;
//csText.Format(TEXT("%s"),
iterpart->GetUserName()/*.c_str()*/);
csText = iterpart->GetUserName();

m_ctrlUserListCtrl.InsertItem(LVIF_TEXT|LVIF_STATE , iIndex, csText,
0,
LVIS_SELECTED, 0, 0);
char * pchText = new char [csText.GetLength() +
1];
strcpy(pchText, (LPCTSTR)csText);
m_ctrlUserListCtrl.SetItemData(iIndex,
(DWORD)pchText);
}
if
(sizeof(pInstData->GetInstName()/*.c_str()*/) 255)
continue;
//csText.Format(TEXT("%s"),
pInstData->GetInstName().c_str());
csText = pInstData->GetInstName();
m_ctrlUserListCtrl.SetItemText(iIndex,
eUserViewListColumn::ASK_INST, csText);
memset(&buffer, 0, sizeof(buffer));
sprintf(buffer, "%%.%df",
pSystemSetting->GetDecimalSize());
csText.Format(buffer, iterpart->GetSize());
m_ctrlUserListCtrl.SetItemText(iIndex,
eUserViewListColumn::ASK_SIZE, csText);
memset(&buffer, 0, sizeof(buffer));
sprintf(buffer, "%%.%df",
pSystemSetting->GetDecimalPrice());
csText.Format(buffer, iter->GetPrice());
m_ctrlUserListCtrl.SetItemText(iIndex,
eUserViewListColumn::ASK_PRICE, csText);
if (sizeof(iterpart->GetTimestamp().c_str()) >
255)
continue;
csText.Format("%s",
iterpart->GetTimestamp().c_str());
m_ctrlUserListCtrl.SetItemText(iIndex,
eUserViewListColumn::ASK_TIME, csText);
}
}
}
VERIFY(m_ctrlUserListCtrl.SortItems( CompareFunction, r
einterpret_cast<DWORD>(&m_ctrlUserListCtrl)));
WRITE_LOG_FUNCTION_EXIT("LRESULT
CUserViewFrame::OnNotifyNewData (WPARAM wParam,
PARAM
lParam)")
const char* strVariable1("CUserViewFrame::OnNotifyNewData
END");
CUtility::LogDebugInfo( strVariable1, strValue);
return 0;

}
Is there any chance the sprintf or CString Format function is creating
this problem.

I have spent lot of time it undertsanding this bug with no success. Any

help would be greatly appreciated.
Regards,
Sandy

Jan 25 '07 #1
1 2009
LRESULT CUserViewFrame::OnNotifyNewData (WPARAM wParam, LPARAM lParam)
{
const char* strVariable("CUserViewFrame::OnNotifyNewData START");
const char* strValue("6");
CUtility::LogDebugInfo( strVariable, strValue);
WRITE_LOG_FUNCTION_ENTRY("LRESULT CUserViewFrame::OnNotifyNewData
(WPARAM wParam, LPARAM lParam)")
PInstData pInstData = (PInstData)wParam;
dynamic_cast would be appropriate here, and help protect you against random
messages broadcast by other applications.
if (!pInstData) return 0;
CString csText;
char buffer[255];
LVFINDINFO info;
int iIndex = 0;
PSystemSetting pSystemSetting = CSystemSetting::GetObject();
info.flags = LVFI_WRAP|LVFI_STRING;
std::vector<CMarketData>::const_iterator iter;
std::vector<CParticipant>::const_iterator iterpart;
const std::vector<CMarketData& userListBid =
pInstData->GetMarketDataBid();
for (iter = userListBid.begin(); iter != userListBid.end(); iter++)
{
const std::vector<CParticipant& participants =
iter->GetParticipants();
for (iterpart = participants.begin(); iterpart !=
participants.end();
iterpart++)
{
if (iterpart->GetSize() 0.0 && iter->GetPrice()
>0.0)
{
memset(&buffer, 0, sizeof(buffer));
if (sizeof(iterpart->GetUserName()/*.c_str()*/) 255
continue;
//sprintf(buffer, "%s",
iterpart->GetUserName()/*.c_str()*/);
info.psz = iterpart->GetUserName();
iIndex = m_ctrlUserListCtrl.FindItem(&info);
if (iIndex == -1)
{ // insert the item
iIndex = m_ctrlUserListCtrl.GetItemCount();
if (sizeof(iterpart->GetUserName()/*.c_str()*/)
>255
continue;
//csText.Format(TEXT("%s"),
iterpart->GetUserName()/*.c_str()
csText = iterpart->GetUserName(); //Sanjeev
012407
int size = iterpart->GetUserName().GetLength();

char bufsize[20];
memset(&bufsize, 0, sizeof(bufsize));
_itoa(size,bufsize,10);
CUtility::LogDebugInfo( "OnNotifyNewData - BID
UserName", bufsize);

m_ctrlUserListCtrl.InsertItem(LVIF_TEXT|LVIF_STATE , iIndex, csText,
0,
LVIS_SELECTED, 0, 0);
char * pchText = new char [csText.GetLength() +
1];
strcpy(pchText, (LPCTSTR)csText);
m_ctrlUserListCtrl.SetItemData(iIndex,
(DWORD)pchText);
}
if
(sizeof(pInstData->GetInstName()/*.c_str()*/) 255)
continue;
//csText.Format(TEXT("%s"),
pInstData->GetInstName()/*.c_str()*/);
csText =
pInstData->GetInstName();
m_ctrlUserListCtrl.SetItemText(iIndex,
eUserViewListColumn::BID_INST, csText);
memset(&buffer, 0, sizeof(buffer));
sprintf(buffer, "%%.%df",
pSystemSetting->GetDecimalSize());
csText.Format(buffer, iterpart->GetSize());
m_ctrlUserListCtrl.SetItemText(iIndex,
eUserViewListColumn::BID_SIZE, csText);
memset(&buffer, 0, sizeof(buffer));
sprintf(buffer, "%%.%df",
pSystemSetting->GetDecimalPrice());
csText.Format(buffer, iter->GetPrice());
m_ctrlUserListCtrl.SetItemText(iIndex,
eUserViewListColumn::BID_PRICE, csText);
if (sizeof(iterpart->GetTimestamp().c_str()) >
255)
continue;
csText.Format("%s",
iterpart->GetTimestamp().c_str());
m_ctrlUserListCtrl.SetItemText(iIndex,
eUserViewListColumn::BID_TIME, csText);
}
}
}
const std::vector<CMarketData& userListAsk =
pInstData->GetMarketDataAsk();
for (iter = userListAsk.begin(); iter != userListAsk.end();
iter++)
{
const std::vector<CParticipant& participants =
iter->GetParticipants();
for (iterpart = participants.begin(); iterpart !=
participants.end();
iterpart++)
{
if (iterpart->GetSize() 0.0 &&
iter->GetPrice() 0.0)
{
memset(&buffer, 0, sizeof(buffer));
if (sizeof(iterpart->GetUserName()/*.c_str()*/)
>255)
continue;
//sprintf(buffer, "%s",
iterpart->GetUserName()/*.c_str()*/);
int size = iterpart->GetUserName().GetLength();

char bufsize[20];
memset(&bufsize, 0, sizeof(bufsize));
_itoa(size,bufsize,10);
CUtility::LogDebugInfo( "OnNotifyNewData - ASK
UserName", bufsize);
info.psz = iterpart->GetUserName();
iIndex = m_ctrlUserListCtrl.FindItem(&info);
if (iIndex == -1)
{ // insert the item
iIndex = m_ctrlUserListCtrl.GetItemCount();
if (sizeof(iterpart->GetUserName()/*.c_str()*/)
>255)
continue;
//csText.Format(TEXT("%s"),
iterpart->GetUserName()/*.c_str()*/);
csText = iterpart->GetUserName();

m_ctrlUserListCtrl.InsertItem(LVIF_TEXT|LVIF_STATE , iIndex, csText,
0,
LVIS_SELECTED, 0, 0);
char * pchText = new char [csText.GetLength() +
1];
strcpy(pchText, (LPCTSTR)csText);
m_ctrlUserListCtrl.SetItemData(iIndex,
(DWORD)pchText);
}
if
(sizeof(pInstData->GetInstName()/*.c_str()*/) 255)
continue;
//csText.Format(TEXT("%s"),
pInstData->GetInstName().c_str());
csText = pInstData->GetInstName();
m_ctrlUserListCtrl.SetItemText(iIndex,
eUserViewListColumn::ASK_INST, csText);
memset(&buffer, 0, sizeof(buffer));
sprintf(buffer, "%%.%df",
pSystemSetting->GetDecimalSize());
csText.Format(buffer, iterpart->GetSize());
m_ctrlUserListCtrl.SetItemText(iIndex,
eUserViewListColumn::ASK_SIZE, csText);
memset(&buffer, 0, sizeof(buffer));
sprintf(buffer, "%%.%df",
pSystemSetting->GetDecimalPrice());
csText.Format(buffer, iter->GetPrice());
m_ctrlUserListCtrl.SetItemText(iIndex,
eUserViewListColumn::ASK_PRICE, csText);
if (sizeof(iterpart->GetTimestamp().c_str()) >
255)
continue;
csText.Format("%s",
iterpart->GetTimestamp().c_str());
m_ctrlUserListCtrl.SetItemText(iIndex,
eUserViewListColumn::ASK_TIME, csText);
}
}
}
VERIFY(m_ctrlUserListCtrl.SortItems( CompareFunction, r
einterpret_cast<DWORD>(&m_ctrlUserListCtrl)));
WRITE_LOG_FUNCTION_EXIT("LRESULT
CUserViewFrame::OnNotifyNewData (WPARAM wParam,
PARAM
lParam)")
const char* strVariable1("CUserViewFrame::OnNotifyNewData
END");
CUtility::LogDebugInfo( strVariable1, strValue);
return 0;

}
Is there any chance the sprintf or CString Format function is creating
this problem.

I have spent lot of time it undertsanding this bug with no success. Any

help would be greatly appreciated.
Regards,
Sandy

Jan 25 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Ken Lindner | last post by:
I have a need to become familiar with SQL Server 2000 for work. Needless to say I am new to SQL Server any version, but not IT in general. My employer has provided me with the SQL Server 2000...
3
by: Keith | last post by:
I am using the built-in setup installer which comes with VS 2003. I am always having problems running the application on other machines other than my development machines with VS. It seems like...
1
by: klaus.roedel | last post by:
Hi @all, I've implement a python application with boa constructor and wx.python. Now I wanted to add a help to my application. I found the helpviewer, where it is very easy to open a helpbook....
2
by: Christian Kreimer | last post by:
Hi I created an C# windows forms application that holds a user control. The user control itself is an editor for geographical information systems and is based on an ActiveX Library for providing...
1
by: Charles Evans | last post by:
Morning! I have this C# application that occasionally crashes complely and doesn't return any error to the VS IDE. The crash comes as a Microsoft error dialog stating "Application.Exe has...
2
by: m11533 | last post by:
I have written an application that runs as a subprocess of a service, where the service is a .NET C# Windows Service that simply starts the subprocess and then periodically checks that the subprocess...
8
by: mike2036 | last post by:
I have an application (that has unmanaged code) and when I launch it without 'FullTrust' permissions (LocalIntranet_Zone), it crashes. When I set 'FullTrust' permissions, it launches fine. Is...
1
by: powersof2 | last post by:
Hello, I need some help with SQL Server 2000 SP4. I've been using the developer product for a few years now on my PC with very few problems. Today when I try to start up Enterprise Manager, it...
0
by: Sandy | last post by:
HI All, I have created a MFC exe using VC++ .NET 2003 on Windows XP Prof service pack 2 and it works properly on my machine, but when I run the same exe on a different machine (Windows XP Prof...
5
by: Frank Rizzo | last post by:
I have a c# 2.0 winform app that runs under a user account with very limited rights. The application crashes on some actions (the Send Error to Microsoft screen) with unauthorized exception. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...

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.