we use an own event handler with a specialized form for displaying bugreports. When the user selects to send the bug report
Code: Select all
procedure ktExceptEventHandler(const exceptIntf: IMEException; var Handled: boolean);
var
...
begin
if exceptIntf.CrashedThreadId = MainThreadID then
begin
...
// if chkSendReport.Checked then
// exceptIntf.SendBugReport;
if chkSendReport.Checked then
begin
exceptIntf.SendInBackground := False;
exceptIntf.SendBugReport;
end;
...
But when I set
Code: Select all
exceptIntf.SendInBackground := False;
I would like to await if the email could be sent and then, if this fails provide a special file creation where both file will be stored with a timestamp in its filename:
Code: Select all
if chkSendReport.Checked then
begin
exceptIntf.SendInBackground := False;
exceptIntf.SendBugReport;
if Supports(exceptIntf, IMEExceptionEx, exceptIntfEx) AND not exceptIntfEx.GetMailWasSent then
begin
tmpDestPath := HMGetSpecialFolderPath(sfUserDocuments, 'Help And Manual BugReports', true);
tmpFileName := IncludeTrailingPathDelimiter(tmpDestPath) + 'bugreport-' + FormatDateTime('yyyymmdd-hhnnss-zzz', Now) + '.txt';
tmpImgFileName := IncludeTrailingPathDelimiter(tmpDestPath) + 'bugreport-' + FormatDateTime('yyyymmdd-hhnnss-zzz', Now) + '.png';
DebugString(tmpFileName, AnsiString(exceptIntf.BugReport), False, True);
exceptIntf.ScreenShot.SavePng(tmpImgFileName);
try
ShellExecute(0, nil, 'explorer.exe', PChar('/select,'+tmpFileName), nil, SW_SHOWNORMAL);
except end;
end;
end;
Thank you for help!
Best regards,
Michael