Search code examples
delphiwinapic++buildervcl

Is it safe to set SEM_FAILCRITICALERRORS on startup with VCL?


I've found that it is recommended to call the SetErrorMode(SEM_FAILCRITICALERRORS) on application startup:
https://learn.microsoft.com/en-us/windows/win32/api/errhandlingapi/nf-errhandlingapi-seterrormode

I know that VCL code sets this mode temporarily in some functions. But it does not do this globally on application startup.

As I do not see any advantage of the default behavior, I'm considering setting it explicitly from my code. I just wonder, if VCL is designed to run in this mode. Is anyone aware of any potential problem? Any reason, why VCL does not set this mode itself?


Solution

  • It's perfectly fine in a VCL application to follow the MSDN advice and set SEM_ FAILCRITICALERRORS at startup.