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
Do you guys know a better (yet simple) way to determine if the CRT is installed?
Update: this is not a Windows 2000 specific issue (thanks Ferruccio). It’s also true for older versions of Windows. As far as I know WinXP, Vista and 7 do NOT display a
MessageBox under the same circumstances.