FIX: "Unhandled exception" in MFC DAO App After VC++ 5.0 SP1 (172405)
The information in this article applies to:
- Microsoft Visual C++, 32-bit Enterprise Edition 5.0 SP1
- Microsoft Visual C++, 32-bit Professional Edition 5.0 SP1
This article was previously published under Q172405 SYMPTOMS
After installing the MFC42.dll (version 4.21.7160) that ships with Visual
C++ 5.0 Service Pack 1, applications that were compiled with Visual C++ 4.2
and use MFC DAO may fail with an unhandled exception or MFC may display a
"Command Failed" error message. Specifically, the exception will occur when
creating index fields (CDaoTableDef::CreateIndex) or retrieving information
about index fields (CDaoTableDef::GetIndexInfo). If you catch the exception
to examine the error message you will see "No error message is available".
CAUSE
Apps compiled with Visual C++ 4.2 should use DAO 3.0. DAO 3.0 GUIDs were
redefined (in DBDAOID.H) after DAO 3.5 was released and MFC DAO source was
not modified to use the new definitions.
There are two places where MFC DAO uses the wrong GUIDs.In DaoCore.cpp:
- Line 5527 inside AfxGetIndexFields(), IID_IDAOIndexFields is used
instead of IID30_IDAOIndexFields.
- Line 5580 inside AfxGetIndexFieldInfo(), IID_IDAOField is used instead
of IID30_IDAOFields.
Any application that directly or indirectly calls these functions will
fail.
RESOLUTION
There are three possible workarounds for this problem:
- Recompile your application with Visual C++ 4.2 and statically link to
MFC.
-or-
- Recompile your application with Visual C++ 5.0.
-or-
- Place the MFC 4.2 dll (from Visual C++ 4.2) inside your application's
directory so it will be used instead of the newer one.
STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed
at the beginning of this article. This bug has been fixed in Visual Studio
97 Service Pack 3.
For more information, please see the following article in the Microsoft
Knowledge Base:
170365
INFO: Visual Studio 97 Service Packs - What, Where, and Why
Modification Type: | Major | Last Reviewed: | 10/24/2003 |
---|
Keywords: | kbbug kbDatabase kbfix kbVS97sp2fix KB172405 kbAudDeveloper |
---|
|