Page 1 of 1

How to show Send bug report dialog

Posted: Fri Dec 15, 2017 7:11 am
by kknyazev
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:

Code: Select all

procedure MyExceptionHandler( const exceptIntf : IMEException; var handled: boolean);
begin
...
        exceptIntf.ShowSetting := ssAssistant;
        exceptIntf.ShowAssistant := MESettings.SendAssistant;
//        exceptIntf.SendBugReport(MainForm.Handle);//   := ssAssistant;
        exceptIntf.Show
        Handled := True;
...
end;
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!

Re: How to show Send bug report dialog

Posted: Fri Dec 15, 2017 9:13 am
by madshi
Try removing "exceptIntf.Show" and "Handled := True". Does that help?

Re: How to show Send bug report dialog

Posted: Fri Dec 15, 2017 1:32 pm
by kknyazev

Code: Select all

        exceptIntf.ShowSetting := ssAssistant;
        exceptIntf.ShowAssistant := MESettings.SendAssistant;
        Handled := False;
No mail created at all, even text

Re: How to show Send bug report dialog

Posted: Fri Dec 15, 2017 3:08 pm
by madshi
Sorry, try using "exceptIntf.SendBugReport()" + "handled := true".

Re: How to show Send bug report dialog

Posted: Mon Dec 18, 2017 6:12 am
by kknyazev
No success, mail created, but with text only

Re: How to show Send bug report dialog

Posted: Mon Dec 18, 2017 3:42 pm
by madshi
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?

Re: How to show Send bug report dialog

Posted: Mon Dec 18, 2017 7:13 pm
by kknyazev
Yes, it is showed normally.

Re: How to show Send bug report dialog

Posted: Mon Dec 18, 2017 7:30 pm
by madshi
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?

Re: How to show Send bug report dialog

Posted: Tue Dec 19, 2017 5:43 am
by kknyazev
Assistant dialog was not showed and mail was not created.
Now i register handler so:

Code: Select all

    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;

Re: How to show Send bug report dialog

Posted: Tue Dec 19, 2017 7:59 am
by madshi
I've tried:

Code: Select all

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?

Re: How to show Send bug report dialog

Posted: Tue Dec 19, 2017 8:57 am
by kknyazev
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

Re: How to show Send bug report dialog

Posted: Tue Dec 19, 2017 9:37 am
by kknyazev
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.

Re: How to show Send bug report dialog

Posted: Tue Dec 19, 2017 9:42 am
by madshi
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.

Re: How to show Send bug report dialog

Posted: Tue Dec 19, 2017 10:38 am
by kknyazev
Sorry, has you set stTrySyncCallAlways in handler registration?