Jazz
Jazz

Reputation: 5917

Create a Windows process to check silently for missing DLLs

I want to check if all the required DLLs are installed for an executable, so I run it with CreateProcess, and I check the exit code.

Problem: Windows displays a popup saying the DLL was not found, then displays a popup saying that the program has stopped working.

How can I avoid all these error popups?

Upvotes: 3

Views: 634

Answers (2)

valdo
valdo

Reputation: 12943

Anyway this won't cover all the problematic cases. Your process may be dependent on delay-load DLLs. You may check your executable by the dependency walker tool (or similar).

However your process may try to load more DLLs at runtime (via LoadLibrary or similar).

Upvotes: 0

David Heffernan
David Heffernan

Reputation: 613053

You need to call SetErrorMode passing SEM_FAILCRITICALERRORS.

The SetErrorMode is a slightly tricky API to use since you need to merge the new mode with the existing modes. Raymond Chen explains how to do it correctly.

Upvotes: 5

Related Questions