Advertisement
RandomClear

How to always create ZIP/ELP file

Feb 26th, 2013
645
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 1.57 KB | None | 0 0
  1. // See also: http://pastebin.com/3irtZ3iU - "how to save/capture ZIP/ELP file"
  2. // See also: http://pastebin.com/kkb5xkST - "'Save' report instead of sending"
  3.  
  4. uses
  5.   ETypes, EDialog, EDialogWinAPIMSClassic, EModules;
  6.  
  7. type
  8.   // Subclass standard dialog class to alter EurekaLog behaviour.
  9.   // Of course, you should replace TMSClassicDialog with another appropriate class if you don't use MS classic dialog style
  10.   TMyMSClassicDialog = class(TMSClassicDialog)
  11.   protected
  12.     function ShowModalInternal: TResponse; override;
  13.   end;
  14.  
  15. { TMyMSClassicDialog }
  16.  
  17. function TMyMSClassicDialog.ShowModalInternal: TResponse;
  18. var
  19.   X: Integer;
  20. begin
  21.   Result := inherited;
  22.  
  23.   // This happens when user clicks on "Details" link - one dialog has to be replaced with another
  24.   if Result.SendResult = srRestart then
  25.     Exit;
  26.  
  27.   // Create files to be send even if no send is used
  28.   if (Failed(Ord(Result.SendResult))) or
  29.      (not CanSend) then
  30.   begin
  31.     PrepareFilesForSend;
  32.  
  33.     // Copy all files attachments to some folder.
  34.     // Of course, folder must exist and be writable.
  35.     // Usually there is only one file (.elp), but it can be few files - depends on your project options
  36.     for X := 0 to FilesToSend.Count - 1 do
  37.       CopyFile(PChar(FilesToSend[X]), PChar('C:\Users\UserName\Documents\BugReports\' + ExtractFileName(FilesToSend[X])), False);
  38.   end;
  39. end;
  40.  
  41. initialization
  42.   // Register our class to be used by EurekaLog
  43.   RegisterDialogClass(TMyMSClassicDialog);
  44.   // Set our dialog
  45.   CurrentEurekaLogOptions.ExceptionDialogType := TMyMSClassicDialog.ClassName;
  46. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement