How can I get the filename of a "module could not be found" error dialog
See the question and my original answer on StackOverflowI don't think you can do this programmatically. However, if you have access to the machine you can turn on a "global flag" to show what's called "Loader Snaps" (Show loader snaps (Windows Debuggers)) at least to identify the problem.
Here is an article about it that explains how to do it: Debugging LoadLibrary Failures