Click here to Skip to main content
15,895,142 members
Articles / Web Development / HTML

Integrating Crash Reporting into Your Application - A Beginners Tutorial

Rate me:
Please Sign up or sign in to vote.
4.91/5 (30 votes)
5 Feb 2012CPOL12 min read 90.7K   4.4K   170  
This article shows how to use CrashRpt error reporting library with an MFC application
<!-- This comment will put IE 6, 7 and 8 in quirks mode -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="icon" href="../favicon.ico" type="image/x-icon" />
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>CrashRpt: Running Demo Applications</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javaScript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body onload='searchBox.OnSelectItem(0);'>

<table border="0" bgcolor="#FFFFFF" cellspacing="5" width="100%">
 <tr>
  <td width="24px" rowspan="2"><img src="../logo.png" alt="Logo" /></td>
  <td><font family="Arial" size="+2">crashrpt</font></td>
  <td rowspan="2" align="right"><a href="http://sourceforge.net/donate/index.php?group_id=279722"><img src="../donate_small.png" alt="Donate" /></a></td>
 </tr>
 <tr>
  <td colspan="2"><i>A crash reporting system for Windows applications</i></td>
 </tr>


</table>


</body>
<!-- Generated by Doxygen 1.5.9 -->
<script type="text/javascript">
<!--
function changeDisplayState (e){
  var num=this.id.replace(/[^[0-9]/g,'');
  var button=this.firstChild;
  var sectionDiv=document.getElementById('dynsection'+num);
  if (sectionDiv.style.display=='none'||sectionDiv.style.display==''){
    sectionDiv.style.display='block';
    button.src='open.gif';
  }else{
    sectionDiv.style.display='none';
    button.src='closed.gif';
  }
}
function initDynSections(){
  var divs=document.getElementsByTagName('div');
  var sectionCounter=1;
  for(var i=0;i<divs.length-1;i++){
    if(divs[i].className=='dynheader'&&divs[i+1].className=='dynsection'){
      var header=divs[i];
      var section=divs[i+1];
      var button=header.firstChild;
      if (button!='IMG'){
        divs[i].insertBefore(document.createTextNode(' '),divs[i].firstChild);
        button=document.createElement('img');
        divs[i].insertBefore(button,divs[i].firstChild);
      }
      header.style.cursor='pointer';
      header.onclick=changeDisplayState;
      header.id='dynheader'+sectionCounter;
      button.src='closed.gif';
      section.id='dynsection'+sectionCounter;
      section.style.display='none';
      section.style.marginLeft='14px';
      sectionCounter++;
    }
  }
}
window.onload = initDynSections;
-->
</script>
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Contents</span></a></li>
      <li><a href="modules.html"><span>API&nbsp;Reference</span></a></li>
      <li><a href="files.html"><span>File&nbsp;Reference</span></a></li>
    <li>
      <form action="search.php" method="get">
        <table cellspacing="0" cellpadding="0" border="0">
          <tr>
            <td><label>&nbsp;<u>S</u>earch&nbsp;for&nbsp;</label></td>
            <td><input type="text" name="query" value="" size="20" accesskey="s"/></td>
          </tr>
        </table>
      </form>
    </li>
    </ul>
  </div>
  <div class="navpath"><a class="el" href="index.html">CrashRpt Documentation</a>&nbsp;&raquo&nbsp;<a class="el" href="introduction_to_crashrpt.html">Introduction to CrashRpt</a>
  </div>
</div>
<div class="contents">
<h1><a class="anchor" name="demos">Running Demo Applications </a></h1><dl class="note" compact><dt><b>Note:</b></dt><dd>CrashRpt distribution archive contains compiled demo applications for demonstration purposes. If you run the compiled demos from <code>bin</code> folder and do not compile them yourself, you might experience some problems if Visual C++ 2010 Redistributable files are not installed on your machine. There may be error messages like 'The application configuration is incorrect' and so on. If you do not have Visual C++ 2010 Redistributable on your machine and do not want to install it, please compile the solution yourself as described in <a class="el" href="compiling_crashrpt.html">Compiling CrashRpt</a>.</dd></dl>
<h2><a class="anchor" name="crashrpttest">
About CrashRptTest Demo</a></h2>
<b>CrashRptTest</b> demo application shows how CrashRpt intercepts exceptions and how it sends error reports to the software support team. The application has simple dialog based GUI that allows to choose what type of exception to generate and in what thread.<p>
<dl class="note" compact><dt><b>Note:</b></dt><dd>This demo does not uppload error reports to any server, it just demonstrates how error report delivery works. To make this demo to upload your error reports, you need to edit its configuration (see CrashRptTest.cpp file inside of /reporting/crashrpttest folder) and then recompile the demo.</dd></dl>
To run CrashRptTest demo, open <code>bin</code> directory and run <b>CrashRptTest.exe</b>. You can also compile the demo yourself.<p>
CrashRptTest application (see the figure below) is designed to test the most probable crash situations. The <em>Exception type</em> combo box allows to select an exception type. For more information, see <a class="el" href="exception_handling.html">About Exceptions and Exception Handling</a>. The <em>Thread</em> combo box allows to select the thread exception should occur in.<p>
<div align="center">
<img src="crashrpttest.png" alt="crashrpttest.png">
<p><strong>CrashRptTest GUI</strong></p></div>
 <h2><a class="anchor" name="crashcon">
About Crashcon Demo</a></h2>
<b>crashcon</b> demo is a console application (presented below). It generates a SEH exception and shows how CrashRpt intercepts the exception and sends the error report to software support team.<p>
<dl class="note" compact><dt><b>Note:</b></dt><dd>This demo does not uppload error reports to any server, it just demonstrates how error report delivery works. To make this demo to upload your error reports, you need to edit its configuration (see crashcon.cpp file inside of /reporting/crashcon folder) and then recompile the demo.</dd></dl>
To run the demo, open <code>bin</code> directory and run <b>crashcon.exe</b>. You can also compile the demo yourself.<p>
<div align="center">
<img src="crashcon.png" alt="crashcon.png">
<p><strong>crashcon</strong></p></div>
</div>
<hr size="1"><address style="text-align: right;"><small>Generated on Sat Oct 22 17:37:43 2011 for CrashRpt by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.9 </small></address>
</body>
</html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Russian Federation Russian Federation
I am a software developer currently living in Tomsk, Russia. I received a PhD degree in Computer Science from Tomsk Polytechnic University in 2010. I have been professionally developing C/C++ and PHP software since 2005. I like contributing to open-source and writing programming articles for popular web resources, like CodeProject. Besides writing, I love skiing and watching Formula-1.

Comments and Discussions