Boris
Boris

Reputation: 8951

SetErrorMode has no effect?

I call

"SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX);"

before loading a DLL. Nevertheless a windows message pops up

"This application has failed to start because blabla.dll was not found...".

Why does that happen? I thought that was what SetErrorMode was supposed to prevent? Thanks!

Upvotes: 2

Views: 2630

Answers (1)

Eran
Eran

Reputation: 22020

The call to SetErrorMode is probably never executed - if you statically link to the DLL, it will be loaded along with the executable. The message you see is popped by the operating system, and not by your code. If you want control over the load of the DLL, you should load it using LoadLibrary - but then using exported functions is a bit harder.

You can create your own loader (a different executable), which will make sure all DLLs are available, and then run the main executable. But that might be an overkill...

Upvotes: 3

Related Questions