Determine if DAO Jet engine version 3.5 is installed

Sometimes it is useful to know if the computer running your software has the DAO Jet Engine version 3.5 installed.
You need this engine when you work with MFC DAO objects.

I needed to know if DAO 3.5 was there while writing my own setup program for a piece of work which used the
CDaoXYZ stuff, so I wrote a function that detects if the DAO Jet Engine is installed.

The trick used is to check if the the registry key HKEY_LOCAL_MACHINESoftwareMicrosoftJet3.5Engines
exists. If yes, then there’s at least one engine and the DAO Dll’s are installed.

You may use this code as implemented here (a function) or – if you don’t like the global functions – make it a
member function of your class needing the information.

In the header file for the function (or class) definition you need these definitions:

bool	DAO35Installed()
{
  HKEY hLM;

  bool ret=false;

  // let's open the Registry key for DAO 
  if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
    "Software\Microsoft\Jet\3.5\Engines",
    0,KEY_QUERY_VALUE, &hLM) == ERROR_SUCCESS)
  {
    ret = true;
    RegCloseKey(hLM);
  }

  return ret;
}

That’s it. If you need to insure that DAO is installed just test

if (!DAO35Installed())
  // warning here 
else
  // it's OK 

More by Author

Get the Free Newsletter!

Subscribe to Data Insider for top news, trends & analysis

Must Read