Hello,
I want to save the bug report and the screen shot to the <app_folder>\err\<date_time> folder.
It should be done automatically when the exception occurs and the exception dialog will appear.
How to do this?
Regards
Michal
How to save the bug report and the screenshot to a folder
Re: How to save the bug report and the screenshot to a folde
I've replied via email.
Re: How to save the bug report and the screenshot to a folde
Hello,
Thanks a lot for your help and time Mathias.
Here is the final code to solve this problem and may be helpful for other users.
Regards
Michal
Thanks a lot for your help and time Mathias.
Here is the final code to solve this problem and may be helpful for other users.
Regards
Michal
Code: Select all
program Main_app_3;
uses
madExcept,
madLinkDisAsm,
madListHardware,
madListProcesses,
madListModules,
{$IFDEF madExcept}
madZip,
{$ENDIF}
Windows,
Messages,
SysUtils,
Classes,
Variants,
Graphics,
Controls,
Forms,
Dialogs,
App_Menu in 'App_Menu.pas' {FApp_Menu};
{$R *.res}
{$IFDEF madExcept}
procedure MyMadExcept(const exceptIntf : IMEException;
var handled : boolean);
var
AppDir : string;
RapDir : string;
AA : array of WideString; //BDS2006..2007 no unicode
// AA : array of String; //BDS2010..XE.. unicode
begin
AppDir:=ExtractFilePath(Application.ExeName);
RapDir:=DateTimeToStr(Now);
RapDir:=StringReplace(RapDir, ':', '_', [rfReplaceAll,rfIgnoreCase]);
RapDir:=AppDir+'err\'+RapDir+'\';
ForceDirectories(RapDir);
exceptIntf.BeginUpdate;
exceptIntf.BugReportFile:=RapDir+'bug_rep.txt'; //to prevent deletion when sending by e-mail
AutoSaveBugReport(exceptIntf.BugReport, exceptIntf);
exceptIntf.ScreenShot.SavePng('bug_rep.png');
if FileExists(AppDir+'bug_rep.png') then begin
MoveFile(PChar(AppDir+'bug_rep.png'), PChar(RapDir+'bug_rep.png') );
end;
// optional creating zip file
AA:=Nil;
SetLength(AA,2);
AA[0]:=RapDir+'bug_rep.png';
AA[1]:=RapDir+'bug_rep.txt';
madZip.Zip(RapDir+'bug_rep.zip', AA, nil);
AA:=NIL;
exceptIntf.EndUpdate;
end;
{$ENDIF}
begin
Application.Initialize;
Application.CreateForm(TFApp_Menu, FApp_Menu);
if not DirectoryExists(ExtractFilePath(Application.ExeName)+'err')
then ForceDirectories(ExtractFilePath(Application.ExeName)+'err');
{$IFDEF madExcept}
RegisterExceptionHandler(MyMadExcept, stDontSync, epCompleteReport);
with MESettings do begin
AutoSave := false; //uncheck it in the settings wizard !!!
AutoSaveIfNotSent := false;
end;
{$ENDIF}
Application.Run;
end.
Re: How to save the bug report and the screenshot to a folde
Thanks.
Just a few words of explanation: The intention is to save (not send) both the bug report and the screenshot to a folder, and to zip them. This functionality is not natively supported by the madExcept settings dialog. So some custom code is required to make this work, using functions offered by madExcept.
Just a few words of explanation: The intention is to save (not send) both the bug report and the screenshot to a folder, and to zip them. This functionality is not natively supported by the madExcept settings dialog. So some custom code is required to make this work, using functions offered by madExcept.