开发者

SetErrorMode has no effect?

开发者 https://www.devze.com 2023-03-19 07:17 出处:网络
I call \"SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX);\" before loading a DLL. Nevertheless a windows开发者_运维知识库 message pops up

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!


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...

0

精彩评论

暂无评论...
验证码 换一张
取 消