Dialog font size and madExceptPatch.exe

delphi package - automated exception handling
Post Reply
edwinyzh
Posts: 40
Joined: Sat Jun 29, 2013 8:23 am

Dialog font size and madExceptPatch.exe

Post by edwinyzh »

Hello,

I use madExcept 5.0 and the exe patcher for patching the output EXE file before it's being code signed.

As you know, madExcept displays the "Please wait a moment..." message when it's being called.
My question is that the font size of that dialog is way too small on a 4K monitor.
I wonder, is there to increase the font size of the message box?

Thanks!
madshi
Site Admin
Posts: 10365
Joined: Sun Mar 21, 2004 5:25 pm

Re: Dialog font size and madExceptPatch.exe

Post by madshi »

The "Please wait a moment" box only appears in rare/specific circumstances. When exactly do you get it? For example, it appears if one of your exception handlers accesses "exceptIntf.BugReport" before it's fully composed. Maybe instead of tweaking the font sizes, it would be easier and nicer to try to get rid of the window?

Currently, there's no easy way to change the font size of the windows. I plan to look into that at some point, but I'm sooo busy with other stuff atm.
edwinyzh
Posts: 40
Joined: Sat Jun 29, 2013 8:23 am

Re: Dialog font size and madExceptPatch.exe

Post by edwinyzh »

madshi wrote: Wed Jan 27, 2021 9:00 amit appears if one of your exception handlers accesses "exceptIntf.BugReport" before it's fully composed. Maybe instead of tweaking the font sizes, it would be easier and nicer to try to get rid of the window?
yes, in the TMadExceptionHandler.OnException event, GetBugReport is called like the following:

Code: Select all

    // Ensure all the bug report data are fully collected, so that for example the CallstackCrc data is available
    exceptIntf.GetBugReport(True, 10000);
In this case, how to get rid of the window? Thanks!
madshi
Site Admin
Posts: 10365
Joined: Sun Mar 21, 2004 5:25 pm

Re: Dialog font size and madExceptPatch.exe

Post by madshi »

It's a complicated topic. Basically the calculation of the stack traces can take some time. But for the user it looks weird if the application doesn't do anything for several seconds. So the exception box is opened right away, even before the stack traces are calculated, and then the stack traces are added a few seconds later by a background thread.

Now here comes the tricky thing: Your exception handlers need to be called (and fully run through!) before the exception box can be shown. Why? Because your handlers might decide that showing the exception box is not needed/wanted. So madExcept has to wait for your handlers to complete. But if you call GetBugReport(), you're basically forcing the handler to wait until the bug report is complete. Which can take a couple of seconds. So you calling GetBugReport() in your handler forces the exception box to not appear for (potentially) several seconds. That's bad for the user, so in order to indicate to the user that "something" is still happening, madExcept shows the "please wait a moment" box.

So the proper way to solve this is to design your handlers in such a way that they don't delay the exception box visibility. Ideally you would not call (Get)BugReport in your handlers. Alternatively, if you do have to call GetBugReport, please drop the VCL TMadExceptionHandler component, and instead call madExcept.RegisterExceptionHandler in your code manually. This way you have more parameters to work with and you can indicate that your handler should only be called after the bug report creation has been completed. This way you don't delay the visibility of the exception box. However, this way your handler loses the ability to choose not to display the exception box.

If you handler both 1) wants to decide whether to display the exception box or not and 2) needs access to the full bug report, then you may want to consider splitting your handler into 2. One which runs early and does *not* access the bug report and then decides whether to show the exception box or not. And another which runs only after the bug report has been fully created, but then can no longer decide whether to show the exception box or not.

If you follow these guidelines, the "please wait a moment" box should not appear at all.

More information see help of RegisterExceptionHandler.
edwinyzh
Posts: 40
Joined: Sat Jun 29, 2013 8:23 am

Re: Dialog font size and madExceptPatch.exe

Post by edwinyzh »

Thanks for the detailed info!
Post Reply