473,789 Members | 2,931 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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: :OnNotifyNewDat a (WPARAM wParam, LPARAM lParam)
{
const char* strVariable("CU serViewFrame::O nNotifyNewData START");
const char* strValue("6");
CUtility::LogDe bugInfo( strVariable, strValue);
WRITE_LOG_FUNCT ION_ENTRY("LRES ULT CUserViewFrame: :OnNotifyNewDat a
(WPARAM wParam, LPARAM lParam)")
PInstData pInstData = (PInstData)wPar am;
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<CMa rketData>::cons t_iterator iter;
std::vector<CPa rticipant>::con st_iterator iterpart;
const std::vector<CMa rketData& userListBid =
pInstData->GetMarketDataB id();
for (iter = userListBid.beg in(); iter != userListBid.end (); iter++)
{
const std::vector<CPa rticipant& participants =
iter->GetParticipant s();
for (iterpart = participants.be gin(); iterpart !=
participants.en d();
iterpart++)
{
if (iterpart->GetSize() 0.0 && iter->GetPrice()
0.0)
{
memset(&buffer, 0, sizeof(buffer)) ;
if (sizeof(iterpar t->GetUserName( )/*.c_str()*/) 255
continue;
//sprintf(buffer, "%s",
iterpart->GetUserName( )/*.c_str()*/);
info.psz = iterpart->GetUserName( );
iIndex = m_ctrlUserListC trl.FindItem(&i nfo);
if (iIndex == -1)
{ // insert the item
iIndex = m_ctrlUserListC trl.GetItemCoun t();
if (sizeof(iterpar t->GetUserName( )/*.c_str()*/)
255
continue;
//csText.Format(T EXT("%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,bufs ize,10);
CUtility::LogDe bugInfo( "OnNotifyNewDat a - BID
UserName", bufsize);

m_ctrlUserListC trl.InsertItem( LVIF_TEXT|LVIF_ STATE, iIndex, csText,
0,
LVIS_SELECTED, 0, 0);
char * pchText = new char [csText.GetLengt h() +
1];
strcpy(pchText, (LPCTSTR)csText );
m_ctrlUserListC trl.SetItemData (iIndex,
(DWORD)pchText) ;
}
if
(sizeof(pInstDa ta->GetInstName( )/*.c_str()*/) 255)
continue;
//csText.Format(T EXT("%s"),
pInstData->GetInstName( )/*.c_str()*/);
csText =
pInstData->GetInstName( );
m_ctrlUserListC trl.SetItemText (iIndex,
eUserViewListCo lumn::BID_INST, csText);
memset(&buffer, 0, sizeof(buffer)) ;
sprintf(buffer, "%%.%df",
pSystemSetting->GetDecimalSize ());
csText.Format(b uffer, iterpart->GetSize());
m_ctrlUserListC trl.SetItemText (iIndex,
eUserViewListCo lumn::BID_SIZE, csText);
memset(&buffer, 0, sizeof(buffer)) ;
sprintf(buffer, "%%.%df",
pSystemSetting->GetDecimalPric e());
csText.Format(b uffer, iter->GetPrice());
m_ctrlUserListC trl.SetItemText (iIndex,
eUserViewListCo lumn::BID_PRICE , csText);
if (sizeof(iterpar t->GetTimestamp() .c_str()) >
255)
continue;
csText.Format(" %s",
iterpart->GetTimestamp() .c_str());
m_ctrlUserListC trl.SetItemText (iIndex,
eUserViewListCo lumn::BID_TIME, csText);
}
}
}
const std::vector<CMa rketData& userListAsk =
pInstData->GetMarketDataA sk();
for (iter = userListAsk.beg in(); iter != userListAsk.end ();
iter++)
{
const std::vector<CPa rticipant& participants =
iter->GetParticipant s();
for (iterpart = participants.be gin(); iterpart !=
participants.en d();
iterpart++)
{
if (iterpart->GetSize() 0.0 &&
iter->GetPrice() 0.0)
{
memset(&buffer, 0, sizeof(buffer)) ;
if (sizeof(iterpar t->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,bufs ize,10);
CUtility::LogDe bugInfo( "OnNotifyNewDat a - ASK
UserName", bufsize);
info.psz = iterpart->GetUserName( );
iIndex = m_ctrlUserListC trl.FindItem(&i nfo);
if (iIndex == -1)
{ // insert the item
iIndex = m_ctrlUserListC trl.GetItemCoun t();
if (sizeof(iterpar t->GetUserName( )/*.c_str()*/)
255)
continue;
//csText.Format(T EXT("%s"),
iterpart->GetUserName( )/*.c_str()*/);
csText = iterpart->GetUserName( );

m_ctrlUserListC trl.InsertItem( LVIF_TEXT|LVIF_ STATE, iIndex, csText,
0,
LVIS_SELECTED, 0, 0);
char * pchText = new char [csText.GetLengt h() +
1];
strcpy(pchText, (LPCTSTR)csText );
m_ctrlUserListC trl.SetItemData (iIndex,
(DWORD)pchText) ;
}
if
(sizeof(pInstDa ta->GetInstName( )/*.c_str()*/) 255)
continue;
//csText.Format(T EXT("%s"),
pInstData->GetInstName(). c_str());
csText = pInstData->GetInstName( );
m_ctrlUserListC trl.SetItemText (iIndex,
eUserViewListCo lumn::ASK_INST, csText);
memset(&buffer, 0, sizeof(buffer)) ;
sprintf(buffer, "%%.%df",
pSystemSetting->GetDecimalSize ());
csText.Format(b uffer, iterpart->GetSize());
m_ctrlUserListC trl.SetItemText (iIndex,
eUserViewListCo lumn::ASK_SIZE, csText);
memset(&buffer, 0, sizeof(buffer)) ;
sprintf(buffer, "%%.%df",
pSystemSetting->GetDecimalPric e());
csText.Format(b uffer, iter->GetPrice());
m_ctrlUserListC trl.SetItemText (iIndex,
eUserViewListCo lumn::ASK_PRICE , csText);
if (sizeof(iterpar t->GetTimestamp() .c_str()) >
255)
continue;
csText.Format(" %s",
iterpart->GetTimestamp() .c_str());
m_ctrlUserListC trl.SetItemText (iIndex,
eUserViewListCo lumn::ASK_TIME, csText);
}
}
}
VERIFY(m_ctrlUs erListCtrl.Sort Items( CompareFunction , r
einterpret_cast <DWORD>(&m_ctrl UserListCtrl))) ;
WRITE_LOG_FUNCT ION_EXIT("LRESU LT
CUserViewFrame: :OnNotifyNewDat a (WPARAM wParam,
PARAM
lParam)")
const char* strVariable1("C UserViewFrame:: OnNotifyNewData
END");
CUtility::LogDe bugInfo( 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 2035
LRESULT CUserViewFrame: :OnNotifyNewDat a (WPARAM wParam, LPARAM lParam)
{
const char* strVariable("CU serViewFrame::O nNotifyNewData START");
const char* strValue("6");
CUtility::LogDe bugInfo( strVariable, strValue);
WRITE_LOG_FUNCT ION_ENTRY("LRES ULT CUserViewFrame: :OnNotifyNewDat a
(WPARAM wParam, LPARAM lParam)")
PInstData pInstData = (PInstData)wPar am;
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<CMa rketData>::cons t_iterator iter;
std::vector<CPa rticipant>::con st_iterator iterpart;
const std::vector<CMa rketData& userListBid =
pInstData->GetMarketDataB id();
for (iter = userListBid.beg in(); iter != userListBid.end (); iter++)
{
const std::vector<CPa rticipant& participants =
iter->GetParticipant s();
for (iterpart = participants.be gin(); iterpart !=
participants.en d();
iterpart++)
{
if (iterpart->GetSize() 0.0 && iter->GetPrice()
>0.0)
{
memset(&buffer, 0, sizeof(buffer)) ;
if (sizeof(iterpar t->GetUserName( )/*.c_str()*/) 255
continue;
//sprintf(buffer, "%s",
iterpart->GetUserName( )/*.c_str()*/);
info.psz = iterpart->GetUserName( );
iIndex = m_ctrlUserListC trl.FindItem(&i nfo);
if (iIndex == -1)
{ // insert the item
iIndex = m_ctrlUserListC trl.GetItemCoun t();
if (sizeof(iterpar t->GetUserName( )/*.c_str()*/)
>255
continue;
//csText.Format(T EXT("%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,bufs ize,10);
CUtility::LogDe bugInfo( "OnNotifyNewDat a - BID
UserName", bufsize);

m_ctrlUserListC trl.InsertItem( LVIF_TEXT|LVIF_ STATE, iIndex, csText,
0,
LVIS_SELECTED, 0, 0);
char * pchText = new char [csText.GetLengt h() +
1];
strcpy(pchText, (LPCTSTR)csText );
m_ctrlUserListC trl.SetItemData (iIndex,
(DWORD)pchText) ;
}
if
(sizeof(pInstDa ta->GetInstName( )/*.c_str()*/) 255)
continue;
//csText.Format(T EXT("%s"),
pInstData->GetInstName( )/*.c_str()*/);
csText =
pInstData->GetInstName( );
m_ctrlUserListC trl.SetItemText (iIndex,
eUserViewListCo lumn::BID_INST, csText);
memset(&buffer, 0, sizeof(buffer)) ;
sprintf(buffer, "%%.%df",
pSystemSetting->GetDecimalSize ());
csText.Format(b uffer, iterpart->GetSize());
m_ctrlUserListC trl.SetItemText (iIndex,
eUserViewListCo lumn::BID_SIZE, csText);
memset(&buffer, 0, sizeof(buffer)) ;
sprintf(buffer, "%%.%df",
pSystemSetting->GetDecimalPric e());
csText.Format(b uffer, iter->GetPrice());
m_ctrlUserListC trl.SetItemText (iIndex,
eUserViewListCo lumn::BID_PRICE , csText);
if (sizeof(iterpar t->GetTimestamp() .c_str()) >
255)
continue;
csText.Format(" %s",
iterpart->GetTimestamp() .c_str());
m_ctrlUserListC trl.SetItemText (iIndex,
eUserViewListCo lumn::BID_TIME, csText);
}
}
}
const std::vector<CMa rketData& userListAsk =
pInstData->GetMarketDataA sk();
for (iter = userListAsk.beg in(); iter != userListAsk.end ();
iter++)
{
const std::vector<CPa rticipant& participants =
iter->GetParticipant s();
for (iterpart = participants.be gin(); iterpart !=
participants.en d();
iterpart++)
{
if (iterpart->GetSize() 0.0 &&
iter->GetPrice() 0.0)
{
memset(&buffer, 0, sizeof(buffer)) ;
if (sizeof(iterpar t->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,bufs ize,10);
CUtility::LogDe bugInfo( "OnNotifyNewDat a - ASK
UserName", bufsize);
info.psz = iterpart->GetUserName( );
iIndex = m_ctrlUserListC trl.FindItem(&i nfo);
if (iIndex == -1)
{ // insert the item
iIndex = m_ctrlUserListC trl.GetItemCoun t();
if (sizeof(iterpar t->GetUserName( )/*.c_str()*/)
>255)
continue;
//csText.Format(T EXT("%s"),
iterpart->GetUserName( )/*.c_str()*/);
csText = iterpart->GetUserName( );

m_ctrlUserListC trl.InsertItem( LVIF_TEXT|LVIF_ STATE, iIndex, csText,
0,
LVIS_SELECTED, 0, 0);
char * pchText = new char [csText.GetLengt h() +
1];
strcpy(pchText, (LPCTSTR)csText );
m_ctrlUserListC trl.SetItemData (iIndex,
(DWORD)pchText) ;
}
if
(sizeof(pInstDa ta->GetInstName( )/*.c_str()*/) 255)
continue;
//csText.Format(T EXT("%s"),
pInstData->GetInstName(). c_str());
csText = pInstData->GetInstName( );
m_ctrlUserListC trl.SetItemText (iIndex,
eUserViewListCo lumn::ASK_INST, csText);
memset(&buffer, 0, sizeof(buffer)) ;
sprintf(buffer, "%%.%df",
pSystemSetting->GetDecimalSize ());
csText.Format(b uffer, iterpart->GetSize());
m_ctrlUserListC trl.SetItemText (iIndex,
eUserViewListCo lumn::ASK_SIZE, csText);
memset(&buffer, 0, sizeof(buffer)) ;
sprintf(buffer, "%%.%df",
pSystemSetting->GetDecimalPric e());
csText.Format(b uffer, iter->GetPrice());
m_ctrlUserListC trl.SetItemText (iIndex,
eUserViewListCo lumn::ASK_PRICE , csText);
if (sizeof(iterpar t->GetTimestamp() .c_str()) >
255)
continue;
csText.Format(" %s",
iterpart->GetTimestamp() .c_str());
m_ctrlUserListC trl.SetItemText (iIndex,
eUserViewListCo lumn::ASK_TIME, csText);
}
}
}
VERIFY(m_ctrlUs erListCtrl.Sort Items( CompareFunction , r
einterpret_cast <DWORD>(&m_ctrl UserListCtrl))) ;
WRITE_LOG_FUNCT ION_EXIT("LRESU LT
CUserViewFrame: :OnNotifyNewDat a (WPARAM wParam,
PARAM
lParam)")
const char* strVariable1("C UserViewFrame:: OnNotifyNewData
END");
CUtility::LogDe bugInfo( 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
15230
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 Personal disk from the SQL Server 2000 Enterprise kit as this is reported here on the MSDN web site to be the version that is supported on Windows XP. In fact so many of you kind people confess to having succeeded in doing it. I have tried...
3
1537
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 most of the time it is a security/privilege problem. One time I succeeded to run the app by making the user a local administrator of the computer. My app only uses the standard 1.1 system assemblies. The other proprietary assemblies(COM interop...
1
1977
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. So I've create an helpbook with boa constructor and then I open the book with the helpviewer. That's all no problem. It works fine, but when I open the helpbook in my application, I have a problem when I exit it. There MS Windows Error Report...
2
2142
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 basic geografic operations. It works fine most of the time, but sometimes it crashes with weird messages and i'm not able to track the error down - to find out the reason for this problem. It's some kind of an memory problem - I get the message...
1
2588
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 encountered a problem and needs to close.". It allows me to examine an error signature but i have no idea how to use this to my advantage. When I click debug I get an error message from the JIT debugger stating that an "Unhandled Win32 Exception" has...
2
3173
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 is still running, restarting it if it have stopped. The problem is that the application is occasionally crashing, and when it crashes it gets hung up waiting on an Application Errror dialog. How, from the c++ code of the application, do I...
8
6048
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 there a way I can compile the application such that it won't even attempt to launch without correct permissions instead of just crashing? Thanks for any help. -Mike
1
4141
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 crashes immediately. I get the usual "Please tell Microsoft about this problem" dialog and if I click the 'click here' link, I'm presented with a dialog that says: -------------------------------------------------
0
334
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 SP-2), The application is bought up and after some time its throwing a windows xp error dialog
5
4539
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. This is despite the fact that I have try catch blocks around pretty much absolutely everything. I've tried logging to disk, but it seems to crash on a deeper level. The app works fine when run under an admin account. So how can I audit what the...
0
9511
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
10200
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...
0
9020
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7529
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6769
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();...
0
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4093
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3701
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2909
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.