Yes, you can do that. However, there's a catch: The VCL is not thread safe, so if you build your custom dialog with the VCL, you need to be careful that you don't show it in a secondary thread. madExcept's own crash box is built using pure win32 APIs to make it thread safe.
Here's a little code example for replacing the dialog with a VCL window:
- Code: Select all
uses ..., madExcept;
procedure YourOwnDialogCallback(const exceptIntf: IMEException; var handled: boolean);
begin
YourOwnVclDialog.ShowModal;
handled := true;
end;
initialization
RegisterExceptionHandler(YourOwnDialogCallback, stTrySyncCallOnSuccess, epMainPhase);
end.
The key here is the "stTrySyncCallOnSuccess" flag. It tells madExcept that you would like your callback to be called within the context of the main thread. If madExcept succeeds on doing that, your callback will be called on your can show your own dialog. If madExcept is not able to call your callback in the context of the main thread (e.g. because the main thread is frozen), your callback will not be called and the default madExcept crash box will show instead.