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_MACHINE\Software\Microsoft\Jet\3.5\Engines 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 



Comments

  • What should I install to get DAO Jet Engine working in my setup program?

    Posted by Legacy on 07/26/1999 12:00am

    Originally posted by: J.H. Lee

    What should I install to get DAO Jet Engine working in my setup program?
    Would you know what or which DLLs and registry info... is needed on that situation?
    --- in korea (sorry. I'm not native English speaker.)

    Reply
  • What should I install to get DAO Jet Engine working (without Access)?.

    Posted by Legacy on 03/13/1999 12:00am

    Originally posted by: David

    I'd like to know what should I install (which Dll, etc...) to
    get a DAO Jet engine working.

    thx in advance

    Reply
  • An even better way to determine the DAO version

    Posted by Legacy on 02/02/1999 12:00am

    Originally posted by: Chris Yourch

    Call this member function to determine the version of the Microsoft Jet database engine in use. The value returned represents the version number in the form "major.minor"; for example, "3.0". The product version number (for example, 3.0) consists of the version number (3), a period, and the release number (0).


    CString version = CDaoWorkspace::GetVersion();
    LPTSTR pszMajor = version.GetBuffer(0);
    LPTSTR pszMinor = strchr(pszMajor, '.');
    *pszMinor++ = '\0';
    int major = atoi(pszMajor);
    int minor = atoi(pszMinor);

    Reply
  • MFC will do it for you if you open a database

    Posted by Legacy on 10/28/1998 12:00am

    Originally posted by: Eric Cholet

    I detect if DAO isn't installed when trying to open a database
    
    (code below). This makes sure the DAO version expected by the
    linked-in MFC code is installed.

    TRY {
    m_db.m_pWorkspace = &m_workspace;
    m_db.Open (m_path_db, FALSE, FALSE, pwd);
    }
    CATCH (CDaoException, e)
    {
    CString s, t;
    if (e->m_pErrorInfo) {
    // some error with this database
    t.LoadString (IDS_ERR_DB_OPEN);
    s.Format (t, (const char *) e->m_pErrorInfo->m_strDescription);
    }
    else {
    // DAO isn't here
    t.LoadString (IDS_ERR_INIT_DAO);
    s.Format (t, e->m_scode);
    }
    AfxMessageBox (s, MB_ICONSTOP | MB_OK);
    return FALSE;
    }
    END_CATCH
    return TRUE;
    }

    Reply
  • Is testing just for 3.5 good enough?

    Posted by Legacy on 10/13/1998 12:00am

    Originally posted by: John L. Stanley

    Thanks for the useful function.

    Just one question:
    What happens when Microsoft releases the "next" version of Jet? Are they going to put entries in the registry to make it look like a version of 3.5 is loaded -or- are the CDaoXXXX objects suppost to auto-sense the version 4.0 (or whatever) registry hooks and use those?

    I guess what I'm asking is, if I use your function to auto-sense Jet 3.5, will my program fail when a user installs a higher version of Jet?

    Thanks,
    ... JLS

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Live Event Date: December 11, 2014 @ 1:00 p.m. ET / 10:00 a.m. PT Market pressures to move more quickly and develop innovative applications are forcing organizations to rethink how they develop and release applications. The combination of public clouds and physical back-end infrastructures are a means to get applications out faster. However, these hybrid solutions complicate DevOps adoption, with application delivery pipelines that span across complex hybrid cloud and non-cloud environments. Check out this …

  • On-demand Event Event Date: October 29, 2014 It's well understood how critical version control is for code. However, its importance to DevOps isn't always recognized. The 2014 DevOps Survey of Practice shows that one of the key predictors of DevOps success is putting all production environment artifacts into version control. In this webcast, Gene Kim discusses these survey findings and shares woeful tales of artifact management gone wrong! Gene also shares examples of how high-performing DevOps …

Most Popular Programming Stories

More for Developers

RSS Feeds