Consider this part of code:
Try
arqTXT.LoadFromFile(LogPath);
finally
ShowMessage(" The log file could not be found. Check if the service is running. ");
end;
After my message, a system message appears with the message: Cannot open file “C:\log.txt”. Is there a way to not show this system message?
I’m using Delphi 2010
Thanks.
You would like to trap that specific exception (
EInOutErrorif I remember correctly) and let other exceptions that occurred to remain unmuted. So if you get some other exception (e.g.EOutOfMemory) if wont get “swallowed” leaving you with seemingly working but broken code.You can have many exceptions handlers in one construct. Any unhandled exceptions will continue to propagate outside of the try .. except block, until caught elsewhere (e.g. by default exception handler that shows the error box).