callback for LastMantisIssueId after bugreport send

delphi package - automated exception handling
Post Reply
nemopeti
Posts: 10
Joined: Thu Feb 01, 2018 2:05 pm

callback for LastMantisIssueId after bugreport send

Post by nemopeti »

Hello,

How can I got the LastMantisIssueId value, after the user clicked the send button on the madExcept dialog.
I neet to show the send bug ID back to the user in a message box.

I try to find a callback like 'AfterBugReportSend' or something, but I can't find.
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: callback for LastMantisIssueId after bugreport send

Post by madshi »

You can use RegisterExceptActionHandler. See here:

Code: Select all

type
  // enumeration for the exception action events
  TExceptAction = (eaSendBugReport,  eaSaveBugReport,  eaPrintBugReport,   // before assistant
                   eaSendBugReport2, eaSaveBugReport2, eaPrintBugReport2,  // after assistant
                   eaSendBugReport3, eaSaveBugReport3, eaPrintBugReport3,  // after sending/saving/printing
                   eaShowBugReport,
                   eaHelp,
                   eaContinueApplication, eaRestartApplication, eaCloseApplication);
nemopeti
Posts: 10
Joined: Thu Feb 01, 2018 2:05 pm

Re: callback for LastMantisIssueId after bugreport send

Post by nemopeti »

ok, now I can catch the event, but, how can I access the LastMantisIssueId varible content?
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: callback for LastMantisIssueId after bugreport send

Post by madshi »

Simply add "madExcept" to the uses clause, then you can access "LastMantisIssueId" directly.
nemopeti
Posts: 10
Joined: Thu Feb 01, 2018 2:05 pm

Re: callback for LastMantisIssueId after bugreport send

Post by nemopeti »

wow, almost perfect, just one more thing.
How can I close the madexcept dialog, from code.

the flow, I like to make:

exception occures -> madexcept dialog shown -> user clicked the send report button -> after the report successfuly send close madexcept dialog adn showmessage the bug ID
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: callback for LastMantisIssueId after bugreport send

Post by madshi »

You can use madExcept.GetExceptBoxHandle() to get the win32 "HWND" handle of the exception box. I suppose you could try posting WM_CLOSE to it. Not sure if that would work. Alternatively you could use FindWindowEx() to browse through the child windows to get the handle of the "continue application" button and send a message to it to "press" the button.

Please make sure that the GUI you're using to show the Mantis ID is thread safe. The VCL is not thread safe. You could use the win32 API "MessageBox()". Make sure it's "Windows.MessageBox()", just to be safe it's not some VCL variant.
nemopeti
Posts: 10
Joined: Thu Feb 01, 2018 2:05 pm

Re: callback for LastMantisIssueId after bugreport send

Post by nemopeti »

seems perfect, extra thenks for the threadsafe tip!
Post Reply