It seems that calling a P-Invoke while the App is not completed loaded make it spew the errors of the related functions.
For example at the moment I’m trying to load at startup various DLL through LoadLibrary and test if they have exported a particular function.
If I do that while the app completed its load procedure no error are given (just the result is 0 and I can check them through GetLastError), If I do it at startup time (for example the Load event of the form) it spews the errors (for example a missing module etc..).
There is a way to mute those errors?
Note that these are not exceptions, but system messageboxes and try…catch does not work here.
Thanks.
It doesn’t make a lot of sense that you would see message boxes from calling LoadLibrary(). See if P/Invoking SetErrorMode() with SEM_NOOPENFILEERRORBOX solves your problem. Using the Shown instead of a Load event is worth a try too.