How to capture or prevent "The application failed to initialize properly (0x########). Click OK to terminate the application."

StackOverflow https://stackoverflow.com/questions/14141957

  •  12-01-2022
  •  | 
  •  

سؤال

I have a .net console application that I wrote that is being run in the background with CreateProcess. When we run it from a machine without .net installed it pops a window saying "The application failed to initialize properly (0xc0000135). Click OK to terminate the application."

I need this application to return an error when it can't start rather than popping up an interactive message box. Is there any way to prevent it from doing that?

هل كانت مفيدة؟

المحلول

Before callingCreateProcess, call SetThreadErrorMode(SEM_FAILCRITICALERRORS).

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top