The way I'd go about it would be to create a small utility that created a file called thisIeVersion.h
I'd check the version that was currently installed then write this header file accordingly.
Once I had an app that did this, I'd add it to the pre-build steps in the project options. Then as long as this header was included first, everything will just work.
I've used a similar idea in the past to automatically increment the build number. It also has uses in creating a unique fingerprint for each time the app is built..
[EDIT:] Here's some code that will determine the installed version of mshtml. I'll leave it up to you to fill in the blanks and write the thisIeVersion.h file.
#include <stdio.h>
#include <windows.h>
int main()
{
char szBuffer[MAX_PATH+1];
char *szFile = "mshtml.dll";
char *backSlash = "\\";
DWORD verHandle = NULL;
UINT size = 0;
LPBYTE lpBuffer = NULL;
DWORD verSize;
GetSystemDirectory(szBuffer, MAX_PATH);
strcat(szBuffer, backSlash);
strcat(szBuffer, szFile);
verSize = GetFileVersionInfoSize( szBuffer, &verHandle);
if (verSize != NULL)
{
LPSTR verData = new char[verSize];
if (GetFileVersionInfo( szBuffer, verHandle, verSize, verData))
{
if (VerQueryValue(verData,"\\",(VOID FAR* FAR*)&lpBuffer,&size))
{
if (size)
{
VS_FIXEDFILEINFO *verInfo = (VS_FIXEDFILEINFO *)lpBuffer;
if (verInfo->dwSignature == 0xfeef04bd)
{
int major = HIWORD(verInfo->dwFileVersionMS);
int minor = LOWORD(verInfo->dwFileVersionMS);
int build = verInfo->dwFileVersionLS;
printf("Installed MSHTML Version: %d.%d\n", major, minor);
}
}
}
}
}
}