For a custom installer application, I have been working on a crude and efficient way to determine whether the particular version of the C runtime (CRT) we need is installed or not. The technique I use is simply to check if a dummy DLL linked to the CRT libraries would load up properly.

This works gloriously well, except for one simple detail. When the CRT is not installed, on Windows 2000 only , the LoadLibrary error would also cause a MessageBox to be displayed. This stops the flow of the installer and of course, is not very elegant…

But there is a simple trick to get rid of the MessageBox , using the very obscure SetErrorMode system call.

1 2 3 4 :: SetErrorMode ( SEM_FAILCRITICALERRORS ); HMODULE hDll = :: LoadLibrary ( "CrtCheck.Dll" ); // Won't bark if ( hDll ) ; // CRT is installed else ; // CRT is NOT installed

Do you guys know a better (yet simple) way to determine if the CRT is installed?