Hi! I'm trying to skip displaying Full dialog box and show Send assistant dialog, my code in custom exception wich is registered with RegisterExceptionHandler:
And this code works not as default behavior, it creates email but with plain text without attachamnets of bugreport.txt and screenshort.
How can i modify my code to get standard email?
Best regards!
If you comment out the whole exception handler, and the user then presses the "send bug report" button, do you then get the attachment and the screenshot?
I've just tried this and it works just fine for me. Instead of using "MainForm.Handle" try using "GetDesktopWindow", just as a test. Also, in the madExcept "attachments settings" did you activate the option "capture out application only"? If so, does unchecking that option change anything?
DontHookThreads;
RegisterExceptionHandler( AppExceptionHandler, stTrySyncCallAlways);
and process so:
handled := True;
try
if MainForm <> nil then
exceptIntf.BugReportSections.Add( 'Last SQL command info', MainForm.LastSqlCmdInfo);
E := exceptIntf.ExceptObject as Exception;
if IsQueryCancel(E) then Exit;
for i := 0 to Screen.FormCount - 1 do
if (Screen.Forms[i] is TErrorForm) and (TErrorForm(Screen.Forms[i]).ErrorMemo.text = E.Message) then
exit;
case TErrorForm.Exec(E) of
mrOk: Handled := False;
mrYes: begin
exceptIntf.ShowSetting := ssAssistant;
exceptIntf.ShowBugReport(GetDesktopWindow);
Handled := True;
end;
end;
if Assigned(MainForm) then
if IndexText( Trim(E.Message), [
'Connection is not connected',
'TCP Provider: An existing connection was forcibly closed by the remote host.']
) <> -1
then
MainForm.NotifyDisconnect;
except
handled := False;
end;
procedure AppExceptionHandler(const exceptIntf: IMEException; var handled: boolean);
begin
exceptIntf.SendBugReport(GetDesktopWindow);
Handled := true;
end;
RegisterExceptionHandler(AppExceptionHandler, stDoneSync, epMainPhase);
And this works just fine for me. Can you please double check?
Also, in the madExcept "attachments settings" did you activate the option "capture out application only"? If so, does unchecking that option change anything?
Ok. I have big complex project and i will recheck on simple project. "capture out application only" is switched off
P.S. Or may be you can you send me working project for test?
Best regards
The difference is in RegisterExceptionHandler - you use stDontSync, but i can't use it, a need VCL access. Try to change stDontSync to stTrySyncCallAlways in your test project.
You've reported an issue but I can't reproduce it. I'm absolutely willing to help you, but if I'm not able to reproduce the problem, it's hard for me. So the best solution might be for you to create a little test project with which I could reproduce the issue on my PC. Then I can analyze why it's not working.