1

I'm trying to get rid of the error messages Windows sometimes pops when loading a DLL.

I tried to do the following:

UINT oldErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS);
SetErrorMode(oldErrorMode | SEM_FAILCRITICALERRORS);

LoadLibrary(myDll);

SetErrorMode(oldErrorMode);

But I'm still getting the error windows, I tried to load several DLLs to make sure they don't remove the SerErrorMode() so that's not the case.

Does anybody has an idea what else can I try?

Thanks

kambi
  • 2,839
  • 7
  • 32
  • 52
  • What error message does pop up? Can you provide a screenshot or something similar? – Andre Nov 24 '11 at 08:37
  • 1
    Some thoughts. When you call `LoadLibrary`, the other DLL changes the error mode and removes `SEM_FAILCRITICALERRORS`. Or perhaps the errors are not from your calls to `LoadLibrary`, but are in fact from implicitly linked DLLs. – David Heffernan Nov 24 '11 at 09:52
  • I get stuff like "File SYNSOEMU.DLL could not be located in the Windows system folder" , "Can't find registry record", .... – kambi Nov 24 '11 at 12:21
  • David: The setErrorMode should be inherited in the hierarchy unless there's another setErrorMode in between, right? – kambi Nov 24 '11 at 12:22
  • Yes, you need to preserve the existing error mode when setting a new error mode, see http://blogs.msdn.com/b/oldnewthing/archive/2004/07/27/198410.aspx – Remy Lebeau Dec 23 '14 at 17:59

0 Answers0