RandomClear icon

How to always create ZIP/ELP file

RandomClear | PRO | 02/26/13 09:19:27 PM UTC | 0 ⭐ | 995 👁️ | Never ⏰ | []
Delphi |

1.57 KB

|

None

|

0 👍

/

0 👎

// See also: http://pastebin.com/3irtZ3iU - "how to save/capture ZIP/ELP file"
// See also: http://pastebin.com/kkb5xkST - "'Save' report instead of sending"
 
uses
  ETypes, EDialog, EDialogWinAPIMSClassic, EModules;
 
type
  // Subclass standard dialog class to alter EurekaLog behaviour.
  // Of course, you should replace TMSClassicDialog with another appropriate class if you don't use MS classic dialog style
  TMyMSClassicDialog = class(TMSClassicDialog)
  protected
    function ShowModalInternal: TResponse; override;
  end;
 
{ TMyMSClassicDialog }
 
function TMyMSClassicDialog.ShowModalInternal: TResponse;
var
  X: Integer;
begin
  Result := inherited;
 
  // This happens when user clicks on "Details" link - one dialog has to be replaced with another
  if Result.SendResult = srRestart then
    Exit;
 
  // Create files to be send even if no send is used
  if (Failed(Ord(Result.SendResult))) or
     (not CanSend) then
  begin
    PrepareFilesForSend;
 
    // Copy all files attachments to some folder.
    // Of course, folder must exist and be writable.
    // Usually there is only one file (.elp), but it can be few files - depends on your project options
    for X := 0 to FilesToSend.Count - 1 do
      CopyFile(PChar(FilesToSend[X]), PChar('C:\Users\UserName\Documents\BugReports\' + ExtractFileName(FilesToSend[X])), False);
  end;
end;
 
initialization
  // Register our class to be used by EurekaLog
  RegisterDialogClass(TMyMSClassicDialog);
  // Set our dialog
  CurrentEurekaLogOptions.ExceptionDialogType := TMyMSClassicDialog.ClassName;
end.

Comments