Reporting back crashes in MFC-based products

Hello,

We have a product written in MFC using Visual Studio 7.1. We are now
planning to implement a feature that will detect a crash and report to us
the cause of the crash and other meaningful information. The plan is to
provide something similar to Window's error reporting tool.

I found a 3rd party tool for Delphi that instruments the source code. When
the program crashes, it provides information like the name of the function,
module etc.. Is there something similar that I can use with MFC?

The other option is to use MFC's Structured Exception Handling and try to
get a memory dump. However, I suppose, a map-file would be required to
properly interpret the results.

Is there a common or recommended method used by most MFC-based products for
this purpose?

Please point me to the right direction.

Thank you in advance,
Regards,
Sachin Sharma


0
2/1/2005 6:33:26 AM
vc.mfc 33608 articles. 0 followers. Follow

4 Replies
1188 Views

Similar Articles

[PageSpeed] 33

There are a couple ways of doing this.  I would suggest using C++ exception 
handling to handle exceptions passed from the object CMemoryException, which 
would handle seg faults (the cause of many crashes), and possibly through 
that into the WM_KICKIDLE procedure, for idle processing, that way if a 
memory exception is happening, the app could possibly log it to a file or 
report it to the user.  The key is that it must detect the error before 
Windows finds it to my knowledge.  Once Windows sees that crash, alot of the 
time it will just close the app giving it the application no say in what is 
going on, however I am not absolutely sure.

I hope that helps.

Sincerely,
   James Simpson
0
2/1/2005 6:37:03 AM
There are 2 classes of things to consider.
1. Handle the predictable errors that you should - religiously, and
2. Cater for the unexpected.

There is a sample of a debug handler on msdn. You can code the debug handler 
quite easily to load symbols including your app symbols and take a stack 
dump to a disc file or email it. It is not a beginners task at all, but if 
you have solid Win32 its not too difficult either since the API's are well 
documented. This is IMHO the ultimate for a top end fixer upper - I wrote 
one a couple of years ago, but....

But! I found that by writing good quality code with good exception handling 
I just never got any reports of unexpected errors. The simplest solution if 
quality coding fails on you (tch tch) is to compile with a map file and make 
sure you keep it with each released version. Also compile with symbols and 
let Dr Watson do all the hand work for you as a fall back.

With CLR life is easier as all this info / functionality as at hand and 
easily available for including in your application.



"James Simpson" <JamesSimpson@discussions.microsoft.com> wrote in message 
news:73B8D1D1-8973-475C-930C-8E6A69A546EB@microsoft.com...
> There are a couple ways of doing this.  I would suggest using C++ 
> exception
> handling to handle exceptions passed from the object CMemoryException, 
> which
> would handle seg faults (the cause of many crashes), and possibly through
> that into the WM_KICKIDLE procedure, for idle processing, that way if a
> memory exception is happening, the app could possibly log it to a file or
> report it to the user.  The key is that it must detect the error before
> Windows finds it to my knowledge.  Once Windows sees that crash, alot of 
> the
> time it will just close the app giving it the application no say in what 
> is
> going on, however I am not absolutely sure.
>
> I hope that helps.
>
> Sincerely,
>   James Simpson 


0
me8291 (67)
2/1/2005 8:49:37 AM
Hi,

I have never tried to do what you are attempting but upon reading your
description, I immediately thought of SUPERASSERT.
SUPPERASSERT is a macro developed by John Robbins and discussed in both his
Windows Debugging books (which no Windows developer should be without!).

SUPERASSERT (and code) is discussed in John's Bugslayer column of MSJ here:
http://www.microsoft.com/msj/0299/bugslayer/bugslayer0299.aspx

Hopefully, it should steer you in the right direction.

Many thanks,
Andy.

"Sachin Sharma" <sachinssharma@hotmail.com> wrote in message
news:%23wy7EcCCFHA.3524@TK2MSFTNGP15.phx.gbl...
> Hello,
>
> We have a product written in MFC using Visual Studio 7.1. We are now
> planning to implement a feature that will detect a crash and report to us
> the cause of the crash and other meaningful information. The plan is to
> provide something similar to Window's error reporting tool.
>
> I found a 3rd party tool for Delphi that instruments the source code. When
> the program crashes, it provides information like the name of the
function,
> module etc.. Is there something similar that I can use with MFC?
>
> The other option is to use MFC's Structured Exception Handling and try to
> get a memory dump. However, I suppose, a map-file would be required to
> properly interpret the results.
>
> Is there a common or recommended method used by most MFC-based products
for
> this purpose?
>
> Please point me to the right direction.
>
> Thank you in advance,
> Regards,
> Sachin Sharma
>
>


0
2/1/2005 1:10:09 PM
Hello,

Thank you very much for your valuable pointers. Now I can start researching
on all these methods to find the best solution.

Regards,
Sachin Sharma


0
2/1/2005 2:48:28 PM
Reply:

Similar Artilces:

Date Display on Report
I have read the many date display threads on this site but have a new question (at least I think it is new). I am running a report from a parameter query and am able to get the dates to display just fine, but I want to just get the month to display. I don't want the acutal dates from the parameter. I want it to display the Name of the month based on the dates from the parameter. Is there a way to do this? Format ([The Parameter],"mmmm") If the parameter is a reference to a form control Format([Forms]![The Form Name]![The control Name], "mmmm") Or if the cont...

Turn Over Report
I am not an Accountant or Inventory Manager, how would I interpret or what should I be looking for when I read a Turn Over Report? What are the benefits? Where does the Number Of Receipts (are adjustments included?), Quantity Received YTD, Average Inventory, Quantity Sold YTD Number Of Turns YTD, Annual Turns derive from? "tstrop" wrote: > I am not an Accountant or Inventory Manager, how would I interpret or what > should I be looking for when I read a Turn Over Report? What are the benefits? The turnover report reports the number of times your inventory is replaced, ...

Deployment of MFC project
Maybe this is a stupid question, but I have to ask anyway. I'm developing some COM DLL's with MFC support (Use MFC in a shared DLL) and the time has come for deployment. I read the following on MSDN: "When you install your application DLLs and components (including the redistributable files that ship with Visual C++ .NET), it is recommended that you install them only to the applications's local folder". I thought that MFC71.dll, MSVCR71.dll and others should go to the System32 folder. Should I put them in my applications local folder insted? Because of something call...

Word Crashes When I Double-Click a File in the Finder
Version: 2008 Operating System: Mac OS X 10.5 (Leopard) Processor: Intel I am running Office 2008 12.2.3 for Mac on a Mac mini, logged into a network account on a Mac mini server. When I double-click a Word document on my desktop, the file opens completely, as if nothing were wrong, but then Word immediately hangs. The document still appears to be open, but the spinning color wheel spins forever, and Word doesn't respond. However, if I open Word by itself, then click File -> Open and select the file, it works perfectly. Does anybody know what is happening here? ...

Reports not opening
The reports created in a MS Access database are not opening. Also the icon to open a new report in design view is not working either. I think it something related to the settings, but I can quite figure it out. I tried to put the security level in Low but it did not work.Any help is appreciated. This is almost always due to either not having a default printer defined in the Windows Control Panel or an old printer driver. -- Duane Hookom Microsoft Access MVP If I have helped you, please help me by donating to UCP http://www.access.hookom.net/UCP/Default.htm "Toly" wrote: ...

Need to select rows to average based on a value in a different column
Below is an example of my spreadsheet. I'd like to find the average number of users for each "Day of the week" hour combination but I'm not even sure where to start. Date Hour DoW # Users 10/27/2003 10 Mon 11 10/27/2003 11 Mon 11 10/27/2003 13 Mon 10 10/27/2003 14 Mon 11 10/27/2003 15 Mon 9 10/27/2003 16 Mon 9 10/28/2003 8 Tue 5 10/28/2003 9 Tue 6 10/28/2003 10 Tue 4 10/28/2003 11 Tue 8 10/28/2003 13 Tue 7 10/28/2003 14 Tue 7 10/28/2003 15 Tue 7 10/28/2003 16 Tue 10 10/29/2003 8 Wed 7 10/29/2003 9 Wed 10 10/29/2003 10 Wed 11 10/...

Picture to appear based on Product Number
I would like to have a spread sheet that I can type in a product numbe in a cell and have the corrosponding product picture show up in th cell next to it. Can anyone help me -- twonama ----------------------------------------------------------------------- twonaman's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=2402 View this thread: http://www.excelforum.com/showthread.php?threadid=37638 Send me your email or post it here, and I will send you an example file that uses worksheet events. HTH, Bernie MS Excel MVP "twonaman" <twonaman.1q2bac_111...

Excel chart to Access report
Apologies if this isn't the right forum, but I'm clutching at straws here.... I have a chart which must be created in Excel because the Access chart interface does not (to my knowledge) permit custom error bars. The problem is that I want then to include the graph in an Access report. I can see how, via automation, I can address the chart from code in the Access report. I just don't know how to actually include it, if you get my meaning. I thought placing an unbound OLE object control in the report would be a good start, but I don't seem to be able to move the chart data into...

Trial Balance report shows inactive accounts even when exclude che
In version 9.0 sp1, the Trial Balance report shows inactive accounts even when the checkbox to exclude these is checked. I was able to modify the report to exclude these, but need to go back in and make the change if I do not want to exclude. --Ray Nist ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "...

Dumb MFC Question
I have a really dumb question. In my code when I create a CPen, CFont, CBrush, ... and select them into a device context (CDC or CClientDC or other MFC wrapped DC). These objects are not cleaned up. Johan Rosengren has been helping me with some issues (Thanks Johan for you time away from your family this weekend) and he said that I needed to delete the CFont and other objects. That got me curious and I looked at the destructors of these objects (that can be selected into the DC) and sure enough, they don't call DeleteObject method to release them from the system. These include: CPen C...

Report Viewer 2008, 2005
Hi there, I develop web application using reportviewer for VS2008 on 64-bit machine. I can deploy to test server(64-bit) machine and it ran fine. But when move to production server(64-bit). I got the message that say "Could not load file or assembly 'Microsoft.ReportViewer.ProcessingObjectModel, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies" Then I download the redistributable 2008 from http://www.microsoft.com/downloads/details.aspx?FamilyID=CC96C246-61E5-4D9E-BB5F-416D75A1B9EF&displaylang=en and try to insta...

Changing the value of one field based on the value of another field
I have two fields in my database 'driver' and 'loader'. As the driver loads his own vehicle 80% of the time I want the value of the 'loader' field to equal the value in the 'driver' field after the 'driver' field is updated. I have tried a number of options in AfterUpdate but without success. Can anyone help. <barrycrone@eircom.net> wrote in message news:1191205424.828591.46110@w3g2000hsg.googlegroups.com... >I have two fields in my database 'driver' and 'loader'. As the driver > loads his own vehicle 80% of the time I want...

Excel Crashes after Cut and Paste
I'm using Excel 2000. 90% of the time I try to cut and paste or copy and paste (especially a section larger than one cell) it freezes up and then crashes. It doesn't always do it though. Very frustrating. I've tried reinstalling several times. Could it be conflicting with other programs running on my machine? Is it corrupted? Any suggestions are appreciated. Thanks ...

XP crashes/freezes after opening Outlook 2000
After installing a recommended "patch" from Microsoft for Outlook 2000, my XP home ver will freeze up EVERY time I open Outlook 2000; This did not occur before I installed this patch. It has now been long enough that I do not know what exactly I installed, and how to uninstall it. Any help out there? ...

Report Problem 04-08-04
Hi; CRM was running on a virtual directory port was 79. But After getting the back up I needed to format the machine. After reinstalling te machine I have deployed the CRM on port 80. Everything is running perfect except te reports. It says you do not have enough licenses.. Why can I have this error Check all your crystal services are started. Also try restarting them. Another more drastic way would be to rebuild the crystal database. If you have access to partnersource there are instructions on how to do this. "Alper Can" <alperc@datasistem.com.tr> wrote in message new...

powerpoint crashes on ungroup of excel chart 03-16-10
On any chart that is created in excel and either inserted as an object or copy and pasted (I have also pasted it as an image and and excel object) when I go to ungroup the image powerpoint shuts down. In the application event log is: event id 1000, mso.dll error We are running XP SP3 and Office 2003 SP3 I have uninstalled and reinstalled office completely to no avail. Can someone help with some direction? Thanks ...

access report on a cross tab query
i have a cross tab query which gives an output like below with following columns------- ozip dzip week no1 week no2 week no3 columns week no1 , week no2 and so on could be dynamic-- it could also be week no52, week no 51 etc nowi i am trying to create a report based on the above query using report wizard--- how should i create a report when column names keep on changing based on what the user needs pls advise thanks subs wrote: >i have a cross tab query > >which gives an output like below with following columns------- > >ozip dzip week no1 wee...

Browser crashes after logon
IE 6.00 crashes just following logon when accessing CRM. The user can log on successfully with no crash on any other machine in the office. Whatever credentials he uses, though, it crashes on his machine. Any ideas why? Thanks! You might try reinstalling IE. "Jeff P" <jeffp@clcit.com> wrote in message news:0b4801c36e37$1f1ac2d0$a601280a@phx.gbl... IE 6.00 crashes just following logon when accessing CRM. The user can log on successfully with no crash on any other machine in the office. Whatever credentials he uses, though, it crashes on his machine. Any ideas why? Thanks!...

'Merge' Reports
System: Access 2007 on Vista Business Background: User created a well maintained db in Lotus Approach. He does not have the ambition to learn how to redo in Access. This db is updated and maintained properly, and monthly there are reports run on it using ~ 50 queries to generate the ~75 reports. What has changed is that these reports must also be converted to PDFs, and Approach is slower than pondwater creating them. I have worked with him and now his macro that generates his reports also creates a csv file. I have recreated the queries & reports in Access, and I am using linked tab...

windows mail crashes when signature is inserted into emails
Whenever I write an email and try to insert my signature before sending, WindowsMail crashes and closes, and I get the following error message: "Windows Mail could not be started. The application was unable to open the Windows Mail message store..... Close the program or wait for it to complete its operation, then open Windows Mail again. (0x800C0155)" I tried creating a signature and asking it to "always insert" the signature, but whenever I tried to create a new signature, it crashed as well. We ran the wmutility program yesterday and still no success. ...

Req Management Approval Limits Report
Hi, I am trying to put together a SQL query that will show me a user name and approval limit so I can create a report to forward to Finance. I've been looking at the following tables: [DYNAMICS].[dbo].[ReqMgmtSetupUser] [WSS_Content_BusinessPortal].[dbo].[UserInfo] [DYNAMICS].[dbo].[ReqMgmtApprovalTreeNode] But I cannot find a link that will join the user name and the approval limit. I can see that the ID field in [ReqMgmtSetupUser] links to the ResidentID in [ReqMgmtApprovalTreeNode], but I don't think that is the proper Name\ID table combination. Any suggestions?...

Using a query as base for report
Hello, I have created a table where I run a query picking the columns I want in the query. From the query, I create a report. My question is this: Whenever I open the report, I want it to show only the open items. Example: My query has 10 columns, when ALL the fields are populated, the record is complete and does not need to be in the report (i.e. open items report). If the 10 fields are NOT all completed, it's still considered opened and will be on the report when it is run. I think I'm thinking too much about it and making it sound harder to myself. Can you please...

Re: delete row based on conditions #4
Hello Bob, My requirement as below Assembly Pos Prepart a 100 b a 101 l a 102 k a 191 c a 192 f a 193 y a 200 d a 291 g a 300 m a 370 n a 371 w a 400 i i would like to have some indication against position numbers 100,101,102,193,200,370,371 so that i can delete those rows For a particular position number (n00), if any of the following pos extensions exists n0...

Emailing from Excel based on date selection by row
Hi I need help with this code which should check all filled rows in the sheet and compare the date in D(i) with todays date in "H1" and if = send an email. The email part works OK and the code was taken from a forum . But the parameters MailSubj1 and Mailsubj2 values are not passed to the SendNotesMail subroutine. Can anyone help with this? Here is the code: ------------------------- ooo ------------------------------ Sub checkdate() Dim Ws As Worksheet Dim oRow As Long Dim Mailsubj1 As String Dim Mailsubj2 As String Set Ws = ThisWorkbook.Worksheets(&...

OWA Service Unavailable....ready to go back to Groupwise!!!!!
I have been working on this problem for a couple weeks now, and I am desperately trying to avoid a reinstall! This install is less than 6 months old!!! Config: Windows 2000 server SP4, domain controller, only server in the domain. Exchange 2000 server SP3 with August 2004 rollup on same machine. Server is patched and up to date. Since the install back in April, we haven`t had any serious problems with Outlook Web Access. About two weeks ago, it just decided to quit, and started giving "HTTP/1.1 503 Service Unavailable" error messages when users would log in from home. I get the same...