crashrpt | ||
A crash reporting system for Windows applications |
Typedefs | |
typedef BOOL(* | LPGETLOGFILE )(LPVOID lpvState) |
Client crash callback function prototype. | |
Functions | |
int | crAddScreenshot (DWORD dwFlags) |
Adds a screenshot to the crash report. |
typedef BOOL( * LPGETLOGFILE)(LPVOID lpvState) |
Client crash callback function prototype.
[in] | lpvState | Must be set to NULL. |
The crash callback function is called when crash occurs. This way client application is notified about the crash.
It is generally unsafe to do complex actions (e.g. memory allocation, heap operations) inside of this callback. The application state may be unstable.
One reason the application may use this callback for is to close handles to open log files that the application plans to include into the error report. Files should be accessible for reading, otherwise CrashRpt won't be able to include them into error report.
It is also possible (but not recommended) to add files, properties, desktop screenshots, registry keys inside of the crash callback function.
The crash callback function should typically return TRUE
to allow generate error report. Returning FALSE
will prevent crash report generation.
The following example shows how to use the crash callback function.
// define the crash callback BOOL CALLBACK CrashCallback(LPVOID lpvState) { // Do something... return TRUE; }
int crAddScreenshot | ( | DWORD | dwFlags | ) |
Adds a screenshot to the crash report.
[in] | dwFlags | Flags, optional. |
This function can be used to take a screenshot at the moment of crash and add it to the error report. Screenshot information may help the developer to better understand the state of the application at the moment of crash and reproduce the error.
When this function is called, screenshot flags are saved, then the function returns control to the caller. When crash occurs, screenshot is made by the CrashSender.exe process and added to the report.
dwFlags
Use one of the following constants to specify what part of virtual screen to capture:
The main application window is a window that has a caption (WS_CAPTION), system menu (WS_SYSMENU) and the WS_EX_APPWINDOW extended style. If CrashRpt doesn't find such window, it considers the first found process window as the main window.
Screenshots are added in form of PNG files by default. You can specify the CR_AS_USE_JPEG_FORMAT flag to save screenshots as JPEG files instead.
In addition, you can specify the CR_AS_GRAYSCALE_IMAGE flag to make a grayscale screenshot (by default color image is made). Grayscale image gives smaller file size.
If you use JPEG image format, you may better use the crAddScreenshot2() function, that allows to define JPEG image quality.
When capturing entire desktop consisting of several monitors, one screenshot file is added per each monitor.
You should be careful when using this feature, because screenshots may contain user-identifying or private information. Always specify purposes you will use collected information for in your Privacy Policy.